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

# Add a file to a document

> Attach a file as evidence to a document.



## OpenAPI

````yaml api-reference/openapi.json POST /documents/{documentId}/files
openapi: 3.0.0
info:
  title: DSALTA API
  version: 1.0.0
  description: >-
    DSALTA Public API (v1). Authenticate with a Bearer API token issued from
    your organization settings. Each token carries resource-level scopes (e.g.
    documents:read).
  contact: {}
servers:
  - url: https://apip.dsalta.com/v1
    description: Production
security: []
paths:
  /documents/{documentId}/files:
    post:
      tags:
        - Documents
      summary: Add Document File
      description: |-
        Attach a file as evidence to a document.

        Every upload is screened before it is stored: size cap, an allowlist of
        evidence types verified by MAGIC BYTES (not the client's extension or
        Content-Type, which can lie), filename sanitisation, and — when a ClamAV
        daemon is configured — a malware scan that fails closed.
      operationId: AddDocumentFile
      parameters:
        - in: path
          name: documentId
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
              required:
                - file
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicItemResponse_PublicDocument_'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Example 1:
                  value:
                    success: false
                    message: The file content does not match its ".pdf" extension.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Example 1:
                  value:
                    success: false
                    message: 'API token is missing required scope(s): documents:write'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Example 1:
                  value:
                    success: false
                    message: Document not found.
      security:
        - apiToken:
            - documents:write
components:
  schemas:
    PublicItemResponse_PublicDocument_:
      properties:
        data:
          $ref: '#/components/schemas/PublicDocument'
      required:
        - data
      type: object
      additionalProperties: false
    ErrorResponse:
      properties:
        details:
          $ref: '#/components/schemas/Record_string.unknown_'
        message:
          type: string
        success:
          type: boolean
          enum:
            - false
          nullable: false
      required:
        - message
        - success
      type: object
    PublicDocument:
      properties:
        id:
          type: string
        docId:
          type: string
          description: Human-facing document number, e.g. "DOC-014".
        name:
          type: string
        type:
          type: string
          description: Document type, e.g. "POLICY" | "EVIDENCE".
        status:
          type: string
          description: Review status, e.g. "NOT_STARTED" | "IN_PROGRESS" | "COMPLETED".
        description:
          type: string
        dueDate:
          type: string
          nullable: true
          description: ISO 8601 due date, or null if none.
        frameworks:
          items:
            type: string
          type: array
          description: Names of the frameworks this document maps to.
        owner:
          type: string
          nullable: true
          description: Owner's display name, or null. Never an email or internal id.
        files:
          items:
            $ref: '#/components/schemas/PublicDocumentFile'
          type: array
          description: >-
            Evidence on the document — uploaded files and added links, each with
            an

            id so it can be removed. Empty when there is none.
        controls:
          properties:
            total:
              type: number
              format: double
            passing:
              type: number
              format: double
          required:
            - total
            - passing
          type: object
          nullable: true
          description: >-
            The controls this document is linked to as evidence: how many are
            passing

            out of the total. Null when the document is not linked to any
            control.
        createdAt:
          type: string
          description: ISO 8601 creation timestamp.
        updatedAt:
          type: string
          description: ISO 8601 last-update timestamp.
      required:
        - id
        - docId
        - name
        - type
        - status
        - description
        - dueDate
        - frameworks
        - owner
        - files
        - controls
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    Record_string.unknown_:
      properties: {}
      type: object
      description: Construct a type with a set of properties K of type T
    PublicDocumentFile:
      description: 'One piece of evidence on a document: an uploaded file or an added link.'
      properties:
        id:
          type: string
        url:
          type: string
          description: Short-lived download URL for a file, or the link URL for a link.
        type:
          type: string
          enum:
            - file
            - link
          description: '"file" (uploaded to DSALTA) or "link" (an external URL).'
      required:
        - id
        - url
        - type
      type: object
      additionalProperties: false
  securitySchemes:
    apiToken:
      type: http
      scheme: bearer
      bearerFormat: DSALTA_API_TOKEN

````

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