> ## 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 document classification [ap-2]

> Fetch classification of the type of the submitted document



## OpenAPI

````yaml /spec-ap-2.json get /v2/submission/{submission_id}/classification
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-2.documents.resistant.ai
security: []
paths:
  /v2/submission/{submission_id}/classification:
    get:
      summary: Fetch document classification [ap-2]
      description: Fetch classification of the type of the submitted document
      operationId: getClassification
      parameters:
        - in: path
          name: submission_id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            Results of document type classification if classification analysis
            was enabled for the submission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClassificationResponse'
              examples:
                classified:
                  summary: Document classified successfully
                  value:
                    status: SUCCESS
                    analysis_time: '2024-03-15T10:30:00Z'
                    deployment_version: 3.5.1
                    query_id: customer-doc-789
                    sha256: >-
                      e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
                    mime_type: application/pdf
                    document_classification:
                      score: CLASSIFIED
                      document_type: bank_document
                      detailed_type: bank_statement
                      issuer_parent:
                        name: Example Banking Group
                        country: GBR
                      issuer:
                        name: Example Bank Ltd
                        country: GBR
                        issuer_id: '07825439'
                        legal_address:
                          street_address: 1 Example Street, London, EC1A 1BB
                      variant: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - OAuth2:
            - submissions.read
components:
  schemas:
    ClassificationResponse:
      title: Document type classification response
      discriminator:
        propertyName: status
        mapping:
          SUCCESS:
            $ref: '#/components/schemas/ClassificationSuccessResponse'
          FAILED:
            $ref: '#/components/schemas/PipelineFailedResponse'
          INVALID_INPUT:
            $ref: '#/components/schemas/PipelineInvalidInputResponse'
          SKIPPED:
            $ref: '#/components/schemas/PipelineSkippedResponse'
      anyOf:
        - $ref: '#/components/schemas/ClassificationSuccessResponse'
        - $ref: '#/components/schemas/PipelineFailedResponse'
        - $ref: '#/components/schemas/PipelineInvalidInputResponse'
        - $ref: '#/components/schemas/PipelineSkippedResponse'
    ClassificationSuccessResponse:
      title: Document type classification success response
      type: object
      properties:
        status:
          title: Status
          enum:
            - SUCCESS
          type: string
        analysis_time:
          title: Analysis time
          description: Timestamp of analysis
          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
        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
        document_classification:
          $ref: '#/components/schemas/DocumentClassification'
          title: Document classification
          description: >-
            Information about the document type and issuer, or null if
            classification is not available
          type: object
      required:
        - status
        - analysis_time
        - deployment_version
        - query_id
        - sha256
        - mime_type
    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
    DocumentClassification:
      title: Document classification
      description: Information about the document type and issuer
      type: object
      properties:
        score:
          $ref: '#/components/schemas/DocumentClassificationScore'
        document_type:
          $ref: '#/components/schemas/DocumentClassificationType'
          nullable: true
        detailed_type:
          $ref: '#/components/schemas/DocumentClassificationDetailedType'
          nullable: true
        issuer_parent:
          $ref: '#/components/schemas/DocumentIssuer'
          title: Parent issuer entity
          description: Parent legal entity of the document issuer
          nullable: true
        issuer:
          $ref: '#/components/schemas/DocumentIssuer'
          title: Document issuer
          description: Legal entity that issued the document
          nullable: true
        variant:
          title: Document variant
          description: >-
            Specific version or variation of the document type for precise
            classification.
          type: string
          minLength: 0
          maxLength: 1024
          nullable: true
    FileType:
      title: FileType
      description: Type of analyzed file
      enum:
        - unsupported
        - pdf
        - image
      type: string
    DocumentClassificationScore:
      title: Classification score
      description: Top-level classification result
      type: string
      nullable: true
      enum:
        - CLASSIFIED
        - DOCUMENT_MISSING
        - NOT_CLASSIFIED
    DocumentClassificationType:
      title: Document type
      description: High-level document type category
      type: string
      nullable: true
      enum:
        - id_document
        - income_confirmation
        - loan_document
        - bank_document
        - utility_bill
        - company_information
        - government_document
        - commercial_document
        - legal_document
        - insurance_document
        - tax_details
        - vehicle_documentation
        - other_document
        - document_missing
        - no_classification
        - null
    DocumentClassificationDetailedType:
      title: Detailed document type
      description: Specific document subtype
      type: string
      nullable: true
      enum:
        - birth_certificate
        - drivers_license
        - health_insurance_card
        - id_card
        - id_certificate
        - passport
        - residence_permit
        - proof_of_address
        - other
        - earnings_confirmation
        - earnings_statement
        - earnings_summary
        - payslip
        - unemployment_certificate
        - other
        - client_assessment
        - costs_estimate
        - loan_agreement
        - loan_application
        - loan_closure
        - security_agreement
        - other
        - account_confirmation
        - account_statement
        - transaction_history
        - bank_details
        - fees_statement
        - payment_confirmation
        - bank_card
        - bank_cheque
        - other
        - energy
        - water
        - utilities
        - telco
        - mobile_phone
        - municipal_services
        - other
        - company_detail
        - employer_identification_number
        - financial_report
        - accounting_records
        - company_share_capital_detail
        - incorporation_certificate
        - other
        - maternity_allowance_claim
        - property_detail
        - postal_document
        - other
        - invoice
        - receipt
        - delivery_note
        - order_confirmation
        - tracking_note
        - transport_order
        - quote
        - payment_request
        - rate_confirmation
        - load_confirmation
        - order
        - other
        - rental_agreement
        - court_document
        - employment_contract
        - contract
        - policy
        - education_certificate
        - marriage_certificate
        - death_certificate
        - divorce_certificate
        - apostille
        - legal_notice
        - other
        - insurance_claim
        - insurance_documentation
        - insurance_claim_settlement
        - investigation_report
        - proof_of_insurance
        - other
        - tax_form
        - tax_information
        - other
        - vehicle_appraisal
        - vehicle_registration_certificate
        - vehicle_technical_certificate
        - other
        - medical_report
        - email
        - letter
        - loan_offer
        - credit_card
        - ticket
        - report
        - paper_date
        - screenshot
        - resume
        - other
        - missing
        - null
    DocumentIssuer:
      title: Document issuer
      description: Information about the legal entity that issued the document
      type: object
      nullable: true
      properties:
        name:
          title: Issuer name
          description: Legal name of the issuing entity
          maxLength: 1024
          type: string
        country:
          $ref: '#/components/schemas/CountryCode'
        issuer_id:
          title: Issuer ID
          description: Official identifier of the issuing legal entity
          maxLength: 1024
          type: string
          example: '07825439'
        legal_address:
          $ref: '#/components/schemas/PhysicalAddress'
      required:
        - name
        - country
    CountryCode:
      title: Country code
      description: ISO 3166-1 alpha-3 country code or UNKNOWN
      type: string
      maxLength: 1024
      nullable: true
    PhysicalAddress:
      title: Address
      type: object
      properties:
        street_address:
          type: string
          example: 16192 COASTAL HWY, LEWES, DE 19958
      required:
        - street_address
  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'
    TooManyRequests:
      description: Request quota was exceeded
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://eu.id.resistant.ai/oauth2/aus827qzu1l953dI4417/v1/token
          scopes:
            submissions.read: Read analysis results for a submission
            submissions.write: Create a new submission

````