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
- Basis-URL
https://runapi.ai- API-Version
v1- Authentifizierung
Authorization: Bearer YOUR_API_KEY
02
JSON-BodyAnfrage
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
HTTP 201Erfolgsantwort
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
HTTP 401Fehlerantwort (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
HTTP 403Fehlerantwort (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
HTTP 400Fehlerantwort (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
HTTP 408Fehlerantwort (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
HTTP 413Fehlerantwort (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
HTTP 415Fehlerantwort (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
HTTP 422Fehlerantwort (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
HTTP 429Fehlerantwort (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"}'