# Dateiverwaltung

## Datei hochladen

> **POST** `/v3/files`

Laden Sie eine Datei auf die Tripo-Plattform hoch und erhalten Sie einen file_token für nachfolgende API-Aufrufe.

### Anforderungsparameter

#### Anforderungsheader

| Parameter | Typ | Erforderlich | Standard | Beschreibung |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | Zeichenfolge | Ja | — | `multipart/form-data` |
| Authorization | Zeichenfolge | Ja | — | `Bearer {api_key}` |

#### Anforderungstext (multipart/form-data)

| Parameter | Typ | Erforderlich | Standard | Beschreibung |
| :-: | :-: | :-: | :-: | :-: |
| file | binär | Ja | — | Dateidaten. Bilder unterstützen JPEG/PNG, bis zu 20 MB. Die Modelle unterstützen GLB/GLTF/FBX/OBJ/STL, bis zu 150 MB |

#### Beispiel anfordern

##### curl

```bash
curl -X POST https://openapi.tripo3d.ai/v3/files \
  -H "Authorization: Bearer {api_key}" \
  -F "file=@/path/to/model.glb"
```

##### Python

```python
import requests

url = "https://openapi.tripo3d.ai/v3/files"
headers = {
    "Authorization": "Bearer {api_key}"
}
files = {
    "file": open("/path/to/model.glb", "rb")
}

response = requests.post(url, headers=headers, files=files)
print(response.json())
```

##### JavaScript

```javascript
const url = "https://openapi.tripo3d.ai/v3/files";

const formData = new FormData();
formData.append("file", fileBlob, "model.glb");

const response = await fetch(url, {
  method: "POST",
  headers: {
    "Authorization": "Bearer {api_key}"
  },
  body: formData
});

const data = await response.json();
console.log(data);
```

### Antwort

#### Erfolgreiche Antwort

```json
{
  "code": 0,
  "data": {
    "file_token": "file_abc123"
  }
}
```

#### Antwortfelder

| Parameter | Typ | Beschreibung |
| :-: | :-: | :-: |
| code | ganze Zahl | Statuscode. `0` zeigt Erfolg an |
| data.file_token | Zeichenfolge | Eindeutige Dateikennung, die für nachfolgende API-Aufrufe verwendet wird |

---

## Holen Sie sich Upload-Anmeldeinformationen

> **POST** `/v3/files/upload-credentials`

Erhalten Sie direkte Upload-Anmeldeinformationen (STS), um große Dateien direkt vom Client in den Cloud-Speicher hochzuladen.

### Anforderungsparameter

#### Anforderungsheader

| Parameter | Typ | Erforderlich | Standard | Beschreibung |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | Zeichenfolge | Ja | — | `application/json` |
| Authorization | Zeichenfolge | Ja | — | `Bearer {api_key}` |

#### Beispiel anfordern

##### curl

```bash
curl -X POST https://openapi.tripo3d.ai/v3/files/upload-credentials \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {api_key}"
```

##### Python

```python
import requests

url = "https://openapi.tripo3d.ai/v3/files/upload-credentials"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_key}"
}

response = requests.post(url, headers=headers)
print(response.json())
```

##### JavaScript

```javascript
const url = "https://openapi.tripo3d.ai/v3/files/upload-credentials";

const response = await fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_key}"
  }
});

const data = await response.json();
console.log(data);
```

### Antwort

#### Erfolgreiche Antwort

```json
{
  "code": 0,
  "data": {
    "file_token": "file_abc123",
    "upload_url": "https://storage.example.com/upload/...",
    "expires_at": "2025-01-01T01:00:00Z"
  }
}
```

#### Antwortfelder

| Parameter | Typ | Beschreibung |
| :-: | :-: | :-: |
| code | ganze Zahl | Statuscode. `0` zeigt Erfolg an |
| data.file_token | Zeichenfolge | Eindeutiger Dateibezeichner |
| data.upload_url | Zeichenfolge | Vorsignierter Upload URL. Der Client lädt die Datei direkt mit PUT hoch |
| data.expires_at | Zeichenfolge | Ablaufzeit der Anmeldeinformationen (ISO 8601) |
