Zum Inhalt springen
API-Referenz
API-Referenz

Einen File-Upload erstellen

Eine lokale Datei, eine remote HTTPS-URL oder eine Base64-Quelle hochladen und eine temporäre URL erhalten.

Eine lokale Datei, eine remote HTTPS-URL oder eine Base64-Quelle hochladen und eine temporäre URL erhalten.

Endpunkt

POST /api/v1/files
Basis-URL
https://runapi.ai
API-Version
v1
Authentifizierung
Authorization: Bearer YOUR_API_KEY
02

Anfrage

JSON-Body

Werte nur am angegebenen Anfrage-Speicherort senden.

application/json - Base64 source4 Felder
file_namestring
Optional

Optionaler Dateiname für den erstellten Datei-Upload.

sourceobject
Erforderlich

Base64-kodierte Quell-Bytes.

source.datastring
Erforderlich

Base64-Daten

source.typestring
Erforderlich

Wählt die base64-Quellrepräsentation aus.

application/json - URL source4 Felder
file_namestring
Optional

Optionaler Dateiname für den erstellten Datei-Upload.

sourceobject
Erforderlich

Remote-HTTPS-Quelle zum Herunterladen.

source.typestring
Erforderlich

Wählt die URL-Quellrepräsentation aus.

source.urlstring
Erforderlich

Öffentliche HTTPS-URL zum Herunterladen.

multipart/form-data2 Felder
filestring
Erforderlich

Lokale Datei-Bytes zum Hochladen.

file_namestring
Optional

Optionaler Dateiname für den erstellten Datei-Upload.

03

Erfolgsantwort

HTTP 201

POST /api/v1/files

JSON
{
  "created_at": "2026-07-27T10:00:00.000Z",
  "expires_at": "2026-07-27T11:00:00.000Z",
  "file_name": "mask.png",
  "mime_type": "image/png",
  "size_bytes": 204800,
  "url": "https://file.runapi.ai/temp/user-uploads/mask.png"
}
04

Fehlerantwort (401)

HTTP 401
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Authentication required"
}
05

Fehlerantwort (403)

HTTP 403
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Standard API key required"
}
06

Fehlerantwort (400)

HTTP 400
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Only HTTPS URLs are allowed"
}
07

Fehlerantwort (408)

HTTP 408
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Download timeout"
}
08

Fehlerantwort (413)

HTTP 413
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "File size exceeds the maximum allowed size"
}
09

Fehlerantwort (415)

HTTP 415
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "This content type is not supported"
}
10

Fehlerantwort (422)

HTTP 422
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "File upload failed. Please try again."
}
11

Fehlerantwort (429)

HTTP 429
Antwort-Schema
JSON
{
  "properties": {
    "error": {
      "description": "Für Menschen lesbare Fehlermeldung.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Antwortbeispiel

JSON
{
  "error": "Too many file uploads for this account. Please retry later."
}
12

cURL-Beispiel

CURL
curl -X POST https://runapi.ai/api/v1/files \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"source":{"type":"url","url":"https://cdn.runapi.ai/public/samples/mask.png"},"file_name":"mask.png"}'