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

# Remove a document

> Removes a document uploaded by mistake, while the case is `pending-documentation` or `ready-to-issue`.
If it was needed to meet a requirement, the case goes back to `pending-documentation`.




## OpenAPI

````yaml /openapi/arco-partner-api.json delete /non-payment-insurance/cases/{caseId}/documents/{documentId}
openapi: 3.1.0
info:
  title: Vivara Partner API
  version: 1.0.0
  description: >
    Vivara's external API for tenant scoring and non-payment insurance.


    ## Authentication


    Every request must include the `X-API-Key` header with the API key issued to
    the integration. Keys are scoped per API client: scorings and cases created
    with one key are not visible to other clients.


    ## Conventions


    - Money is always a number in euros with up to two decimals (`1250.5` =
    1,250.50 €).

    - Dates are `YYYY-MM-DD`; timestamps are ISO 8601 in UTC.

    - Every answer that carries a resource wraps it in `data`.

    - Every error has the same body: `status`, `statusCode`, `code` and
    `message`. Use `code`, which is stable, to decide what to do. The catalog of
    codes is in the guides.


    ## Processing model


    **Scorings.** Creating or updating a scoring evaluates every candidature
    synchronously and returns no body. Read the results with `GET
    /scorings/{scoringId}`.


    In this release, evaluation finishes during create or update and `status` is
    `completed`. Document upload and asynchronous evaluation will arrive in a
    later release (`processing` and candidature status `pending`).


    **Non-payment insurance.** You generate the id of the case (a UUID v4) and
    open it with `POST /non-payment-insurance/cases`, which prices the offer
    synchronously and answers `201` with a `Location` header and no body. A case
    id that was already used answers `409`, whatever the data. Read the case,
    with its offer and the documents it requires, with `GET
    /non-payment-insurance/cases/{caseId}`. Upload the documents, issue the
    policy with `POST /non-payment-insurance/cases/{caseId}/policy`, and poll
    the case with exponential backoff (at least 30 s between calls) until it is
    `policy-issued` or `rejected`.


    ## Edge, routing and rate limiting


    Traffic is served through Azure Front Door, which terminates TLS at
    `https://api.vivara.io/v1/*` and forwards requests to the partner API.

    The Front Door web application firewall enforces rate limits per client IP.
    When a limit is exceeded it returns `429 Too Many Requests`; requests
    blocked by firewall rules return `403 Forbidden`. Those two answers come
    from the firewall and have no `code`. A `403` with `code: forbidden` comes
    from the API, when the API client has no access to it. Rate limit values are
    shared during onboarding.


    ## Data protection


    Requests contain personal data (DNI or NIE, income, and the documents of the
    people on a rental contract). Delete a scoring with `DELETE
    /scorings/{scoringId}` once it is no longer needed. Remove a document
    uploaded by mistake with `DELETE
    /non-payment-insurance/cases/{caseId}/documents/{documentId}` while the case
    is `pending-documentation` or `ready-to-issue`. Cases cannot be deleted.
servers:
  - url: https://api.vivara.io/v1
    description: Production
  - url: https://api-stg.vivara.io/v1
    description: Staging
security:
  - apiKeyAuth: []
tags:
  - name: Scorings
    description: >-
      Score candidates for a property and prioritize who to offer a visit to
      first
  - name: Non-payment insurance
    description: >-
      Quote, document upload and policy issuance for rental non-payment
      insurance cases
paths:
  /non-payment-insurance/cases/{caseId}/documents/{documentId}:
    delete:
      tags:
        - Non-payment insurance
      summary: Remove a document
      description: >
        Removes a document uploaded by mistake, while the case is
        `pending-documentation` or `ready-to-issue`.

        If it was needed to meet a requirement, the case goes back to
        `pending-documentation`.
      operationId: deleteCaseDocument
      parameters:
        - $ref: '#/components/parameters/CaseId'
        - name: documentId
          in: path
          required: true
          description: The document id returned on upload.
          schema:
            type: string
            format: uuid
            example: c41a8e93-7d2b-4f6a-b5e1-2a9f0c8d3e17
      responses:
        '204':
          description: Document removed.
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '409':
          $ref: '#/components/responses/ConflictError'
        '429':
          $ref: '#/components/responses/TooManyRequestsError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    CaseId:
      name: caseId
      in: path
      required: true
      description: The case id, a UUID v4 you generate before quoting.
      schema:
        type: string
        format: uuid
        example: 3f9c2a7e-58b1-4d0a-9a51-0c6e2f1b7d42
  responses:
    UnauthorizedError:
      description: >-
        Unauthorized. The X-API-Key header is missing or the API key is not
        valid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: Unauthorized
            statusCode: 401
            code: invalid-api-key
            message: Invalid API key
    ForbiddenError:
      description: >-
        Forbidden. The API client has no access to this API, or the request was
        blocked by the edge firewall.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/Error'
              - 179b90ba-7311-450d-aaec-7de48cb6a4fb
          examples:
            forbidden:
              summary: The API client has no access to this API
              value:
                status: Forbidden
                statusCode: 403
                code: forbidden
                message: The API client has no access to this API
            firewall:
              summary: Blocked by the edge firewall
              value:
                status: Forbidden
                statusCode: 403
                message: Request blocked by the firewall
    NotFoundError:
      description: >-
        Not found. The scoring, the case or the document does not exist for the
        authenticated API client.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            scoringNotFound:
              summary: Scoring not found
              value:
                status: Not Found
                statusCode: 404
                code: scoring-not-found
                message: Scoring 6d1f0c3e-5b8a-4c1e-9f2a-3b7e8d4a1c90 not found
            caseNotFound:
              summary: Case not found
              value:
                status: Not Found
                statusCode: 404
                code: case-not-found
                message: No case exists with id 3f9c2a7e-58b1-4d0a-9a51-0c6e2f1b7d42.
            documentNotFound:
              summary: Document not found in the case
              value:
                status: Not Found
                statusCode: 404
                code: document-not-found
                message: >-
                  No document exists with id
                  c41a8e93-7d2b-4f6a-b5e1-2a9f0c8d3e17 in case
                  3f9c2a7e-58b1-4d0a-9a51-0c6e2f1b7d42.
            pathNotFound:
              summary: The path does not exist
              value:
                status: Not Found
                statusCode: 404
                code: not-found
                message: Cannot GET /non-payment-insurance/unknown
    ConflictError:
      description: >-
        Conflict. The id is already in use with other data, or the status of the
        resource does not allow the operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            scoringAlreadyExists:
              summary: Scoring id already in use
              value:
                status: Conflict
                statusCode: 409
                code: scoring-already-exists
                message: Scoring 6d1f0c3e-5b8a-4c1e-9f2a-3b7e8d4a1c90 already exists
            caseAlreadyExists:
              summary: Case id already used with different data
              value:
                status: Conflict
                statusCode: 409
                code: case-already-exists
                message: Case 3f9c2a7e-58b1-4d0a-9a51-0c6e2f1b7d42 already exists.
            invalidCaseStatus:
              summary: The case status does not allow the action
              value:
                status: Conflict
                statusCode: 409
                code: invalid-case-status
                message: >-
                  The policy can only be issued for a ready-to-issue case; this
                  case is rejected.
    TooManyRequestsError:
      description: >-
        Too many requests. The rate limit enforced by Azure Front Door was
        exceeded. Retry with exponential backoff.
      content:
        application/json:
          schema:
            type: object
            description: >-
              Error answered by the edge firewall (Azure Front Door), before the
              request reaches the API. It has no `code`.
            required:
              - status
              - statusCode
              - message
            properties:
              status:
                type: string
                description: HTTP reason phrase.
              statusCode:
                type: integer
                description: HTTP status code.
              message:
                type: string
                description: Human-readable explanation.
          example:
            status: Too Many Requests
            statusCode: 429
            message: Rate limit exceeded
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: Internal Server Error
            statusCode: 500
            code: internal-error
            message: Something went wrong
  schemas:
    Error:
      type: object
      required:
        - status
        - statusCode
        - code
        - message
      properties:
        status:
          type: string
          description: HTTP reason phrase.
        statusCode:
          type: integer
          description: HTTP status code.
        code:
          type: string
          description: >-
            Stable, machine-readable error code in kebab-case. Use it, not the
            message, to decide what to do. The full list is in the error catalog
            of the guides (Key concepts, Errors).
        message:
          type: string
          description: >-
            Human-readable explanation, in English. It names the fields or the
            documents behind the error.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key issued per external API client.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.