> ## Documentation Index
> Fetch the complete documentation index at: https://creditor-documentation.debbiecollect.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add document

> Attach a document to one of your cases, or to your creditor. Upload the file first with [Upload file](/api-reference/endpoints/files/create) and pass the object it returns as `file`.

Set `type` to `OTHER`. The other document types decide whether a debt has a legal foundation and when it expires, and are set by your debt collection partner as the case progresses.

Consider whether the debtor should be able to see the document. `minAccessRole: "debtor"` shows it in the debtor self-service portal, which is what you want for an invoice copy, a contract or a photo that documents the claim. Leave it out to keep the document between you and your debt collection partner.

**Required scope:** `write:documents`



## OpenAPI

````yaml POST /v1/{tenantId}/documents
openapi: 3.1.0
info:
  title: Debbie Creditor API Docs
  description: >-
    The Debbie Creditor API is a RESTful interface allowing you, as a creditor,
    to programmatically send data to your debt collection partner and access
    your data in the platform. It provides predictable URLs for accessing
    resources, and uses built-in HTTP features to receive commands and return
    responses. This makes it easy to integrate with your own systems, for
    example your ERP or invoicing system.
  version: v1.0.0
  x-logo:
    url: https://debbie-platform.github.io/creditor-api-docs/deb-logo.svg
servers:
  - url: https://api.debbiecollect.com
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Endpoints for interacting with customers
  - name: Files
    description: Endpoints for interacting with files
  - name: Documents
    description: Endpoints for attaching documentation to a case or to your creditor
  - name: Direct payments
    description: Endpoints for registering payments made directly to you
  - name: Voucher types
    description: >-
      Endpoints for reading the voucher types available on your debt collection
      partner
  - name: Billings
    description: Endpoints for reading how a settlement is made up
externalDocs:
  description: Find out more about Debbie here
  url: https://debbiecollect.com
paths:
  /v1/{tenantId}/documents:
    post:
      tags:
        - Documents
      summary: Add document
      description: >-
        Attach a document to one of your cases, or to your creditor. Upload the
        file first with [Upload file](/api-reference/endpoints/files/create) and
        pass the object it returns as `file`.


        Set `type` to `OTHER`. The other document types decide whether a debt
        has a legal foundation and when it expires, and are set by your debt
        collection partner as the case progresses.


        Consider whether the debtor should be able to see the document.
        `minAccessRole: "debtor"` shows it in the debtor self-service portal,
        which is what you want for an invoice copy, a contract or a photo that
        documents the claim. Leave it out to keep the document between you and
        your debt collection partner.


        **Required scope:** `write:documents`
      operationId: create-document
      parameters:
        - in: path
          name: tenantId
          schema:
            type: string
            format: uuid
          required: true
          description: >-
            Id of your debt collection partner's tenant. You can find it on the
            API page in the creditor portal.
      requestBody:
        description: New document
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewDocument'
            example:
              entityId: 3f1c2d4e-5a6b-7c8d-9e0f-1a2b3c4d5e6f
              entityType: case
              type: OTHER
              minAccessRole: debtor
              file:
                fileId: 8d9f0c1e-2b3a-4c5d-6e7f-8a9b0c1d2e3f
                fileName: invoice-D12412347.pdf
                contentType: application/pdf
        required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
components:
  schemas:
    NewDocument:
      type: object
      properties:
        entityId:
          type: string
          format: uuid
          description: Id of the case or the creditor the document belongs to.
        entityType:
          $ref: '#/components/schemas/DocumentEntityType'
        type:
          $ref: '#/components/schemas/DocumentType'
        file:
          $ref: '#/components/schemas/File'
          description: >-
            The uploaded file, as returned by the file endpoint. Only fileId is
            read: the name and content type are taken from the stored file, so
            they always agree with it.
        minAccessRole:
          type: string
          enum:
            - debtor
            - client
            - caseworker
          description: >-
            The least privileged role that may see the document. `debtor` shows
            it to the debtor in the self-service portal, `client` to the
            creditor, `caseworker` only to the collector. Defaults to the
            collector-only level.
        date:
          type: string
          description: >-
            The date of the document itself, which can differ from the date it
            was uploaded. Defaults to now.
        isSigned:
          type: boolean
          description: Whether the document is already signed.
        signedAt:
          type: string
          description: When the document was signed. Only used together with `isSigned`.
        meta:
          type: object
          description: Extra information about the document.
          properties:
            note:
              type: string
              description: A free-text note shown with the document.
            amount:
              type: integer
              description: Amount in the minor unit, used by document types that carry one.
      required:
        - entityId
        - entityType
        - type
    Document:
      type: object
      properties:
        documentId:
          type: string
          format: uuid
        id:
          type: integer
          description: Sequential id of the document
        tenantId:
          type: string
          format: uuid
        entityId:
          type: string
          format: uuid
        entityType:
          $ref: '#/components/schemas/DocumentEntityType'
        type:
          $ref: '#/components/schemas/DocumentType'
        file:
          $ref: '#/components/schemas/File'
        signedFile:
          $ref: '#/components/schemas/File'
          description: The signed version of the file, once the document has been signed.
        minAccessRole:
          type: string
        date:
          type: string
        signedAt:
          type:
            - string
            - 'null'
        createdAt:
          type: string
    DocumentEntityType:
      type: string
      enum:
        - case
        - creditor
      description: >-
        What the document is attached to. `case` hangs it on a collection case,
        `creditor` on the creditor itself.
    DocumentType:
      type: string
      enum:
        - OTHER
        - FOUNDATION
        - SKYLDERKLAERING
        - COURTOPGJORTOGFREMLAGT
        - DOM
        - PAATEGNING
        - FORLIG
        - COURT
        - GAELDSBREV
      description: >-
        What the document is. The types other than `OTHER` carry legal meaning
        in the collection process — they decide whether the debt has a
        foundation and when it expires — and are set by the collector, not by
        you.
    File:
      type: object
      properties:
        fileName:
          type: string
        contentType:
          type: string
        fileId:
          type: string
          format: uuid
      required:
        - fileName
        - contentType
        - fileId
  responses:
    UnauthorizedError:
      description: Access token missing or invalid
    NotFoundError:
      description: The requested resource was not found
    UnprocessableContent:
      description: Unable to process the contained instructions.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authentication with an API key can be done by using a bearer token in
        the Authorization header. This is done using the following format
        `Authorization: Bearer {token}`. API keys are issued and revoked
        directly from the creditor portal under Developers > API.

````