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

# Datei hochladen

> POST /media/

Lädt eine Datei hoch, auf dem **Management-API**-Host (`api.scanova.io`), authentifiziert mit Ihrem rohen Management-API-Schlüssel.

```
POST https://api.scanova.io/media/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
Content-Type: multipart/form-data
```

<ParamField body="file" type="file" required>
  Die hochzuladende Datei. Entweder `file` oder `upload` ist erforderlich.
</ParamField>

<ParamField body="upload" type="file">
  Alias für `file` — geben Sie das eine oder das andere an.
</ParamField>

<ParamField body="file_type" type="string">
  Kommagetrennte Kategorien, gegen die die Validierung eingeschränkt wird (`image`, `video`, `audio`, `pdf`, `doc`, `script`). Siehe [Zulässige Dateitypen auflisten](/de/api-reference/management-api/user-media/allowed-files) für die Akzeptanzkriterien je Kategorie.
</ParamField>

<ParamField body="in_use" type="string">
  Wie diese Datei verwendet wird: `avatar`, `qr_logo`, `qr_content`, `poster`, `qr_image`, `profile_pic`, `banner`, `smart`, `thumbnail`, oder `unknown` (Standard).
</ParamField>

<ParamField body="category" type="string">
  Freitext-Kategorielabel, z. B. ein QR-Kategorie-Slug oder `"Custom Design"`.
</ParamField>

<ParamField body="bulk_media" type="integer">
  Eine Massen-Medien-Batch-ID, aus [Massen-Medien-Batch erstellen](/de/api-reference/management-api/user-media/bulk-create), um diesen Upload damit zu verknüpfen.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.scanova.io/media/" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
    -F "file=@logo.png" \
    -F "in_use=qr_logo" \
    -F "category=custom-design"
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": 4821,
    "file": "media/uploads/104/2026/09/20260908_512873_logo.png",
    "upload": null,
    "file_name": "20260908_512873_logo.png",
    "size": 48213,
    "human_readable_size": "47.08 KB",
    "original_name": "logo.png",
    "bulk_media": null,
    "mime_type": "image/png",
    "file_type": "png",
    "in_use": "qr_logo",
    "category": "custom-design",
    "created": "2026-09-08T10:15:32.120Z",
    "modified": "2026-09-08T10:15:32.120Z"
  }
  ```
</ResponseExample>

## Validierung

* **Erweiterung und MIME-Typ** müssen beide in der Zulassungsliste der erkannten `file_type`-Kategorie vorhanden sein — eine Diskrepanz (z. B. eine `.png`-Erweiterung bei einer Datei, die tatsächlich ein PDF ist) wird abgelehnt.
* **Größe** wird gegen das Limit der Kategorie geprüft — außer bei `pdf`/`doc`-Dateien, wo die Plan-Quota `DOCUMENT_FILE_SIZE` des Kontos (in MB) die statische Obergrenze überschreibt.
* **JavaScript** (`.js`)-Uploads werden geparst, um vor der Größenprüfung zu bestätigen, dass es sich um syntaktisch gültiges JS handelt.
* **SVGs** werden auf eingebettete Skripte gescannt und bei einem Fund abgelehnt.
* Dateien ohne Erweiterung werden grundsätzlich abgelehnt.

`400` bei jedem der oben genannten Validierungsfehler, mit einer Meldung, die das Problem benennt.

## Verwandte Themen

* [Hochgeladene Dateien auflisten](/de/api-reference/management-api/user-media/list) — sehen, was bereits hochgeladen wurde.
* [Zulässige Dateitypen auflisten](/de/api-reference/management-api/user-media/allowed-files) — vor dem Hochladen clientseitig validieren.
* [Datei löschen](/de/api-reference/management-api/user-media/delete) — eine entfernen.
* [Übersicht über die Management API](/de/api-reference/management-api/overview) — das Authentifizierungsschema und die Quota-Regeln für diesen Endpunkt.


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /media/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.scanova.io (QR codes, folders, tags, leads, forms, analytics, plans,
    shared users & roles), plus the token-creation and usage-stats endpoints
    used to authenticate against it. Every path and request/response shape below
    was verified live against a real API key and the actual running backend
    (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /media/:
    post:
      summary: Upload a file
      description: >-
        Multipart file upload. Validates extension, MIME type, and size against
        the file_type's allow-list (or the account's DOCUMENT_FILE_SIZE quota
        for pdf/doc files); JavaScript uploads are additionally parsed to
        confirm they're syntactically valid, and SVGs are scanned for embedded
        scripts.
      operationId: uploadMedia
      requestBody:
        content:
          multipart/form-data:
            example:
              file: (binary file)
              in_use: qr_logo
              category: custom-design
      responses:
        '201':
          description: File uploaded.
          content:
            application/json:
              example:
                id: 4821
                file: media/uploads/104/2026/09/20260908_512873_logo.png
                upload: null
                file_name: 20260908_512873_logo.png
                size: 48213
                human_readable_size: 47.08 KB
                original_name: logo.png
                bulk_media: null
                mime_type: image/png
                file_type: png
                in_use: qr_logo
                category: custom-design
                created: '2026-09-08T10:15:32.120Z'
                modified: '2026-09-08T10:15:32.120Z'
        '400':
          description: >-
            Missing file, no extension, MIME/extension mismatch, invalid
            JavaScript, SVG failed the XSS scan, or file size exceeds the
            allowed limit.
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````