# 파일 관리
## 파일 업로드
> **POST** `/v3/files`
Tripo 플랫폼에 파일을 업로드하고 후속 API 호출을 위해 file_token를 얻습니다.
### 요청 매개변수
#### 요청 헤더
| 매개변수 | 유형 | 필수 | 기본값 | 설명 |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | 문자열 | 예 | — | `multipart/form-data` |
| Authorization | 문자열 | 예 | — | `Bearer {api_key}` |
#### 요청 본문(multipart/form-data)
| 매개변수 | 유형 | 필수 | 기본값 | 설명 |
| :-: | :-: | :-: | :-: | :-: |
| file | 바이너리 | 예 | — | 파일 데이터. 이미지는 JPEG/PNG, 최대 20개의 MB를 지원합니다. 모델은 GLB/GLTF/FBX/OBJ/STL, 최대 150개의 MB를 지원합니다. |
#### 요청 예시
##### 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);
```
### 응답
#### 성공적인 대응
```json
{
"code": 0,
"data": {
"file_token": "file_abc123"
}
}
```
#### 응답 필드
| 매개변수 | 유형 | 설명 |
| :-: | :-: | :-: |
| code | 정수 | 상태 코드. `0`는 성공을 나타냅니다. |
| data.file_token | 문자열 | 후속 API 호출에 사용되는 고유 파일 식별자 |
---
## 업로드 자격 증명 받기
> **POST** `/v3/files/upload-credentials`
클라이언트에서 클라우드 스토리지로 직접 대용량 파일을 업로드하려면 직접 업로드 자격 증명(STS)을 받으세요.
### 요청 매개변수
#### 요청 헤더
| 매개변수 | 유형 | 필수 | 기본값 | 설명 |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | 문자열 | 예 | — | `application/json` |
| Authorization | 문자열 | 예 | — | `Bearer {api_key}` |
#### 요청 예시
##### 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);
```
### 응답
#### 성공적인 대응
```json
{
"code": 0,
"data": {
"file_token": "file_abc123",
"upload_url": "https://storage.example.com/upload/...",
"expires_at": "2025-01-01T01:00:00Z"
}
}
```
#### 응답 필드
| 매개변수 | 유형 | 설명 |
| :-: | :-: | :-: |
| code | 정수 | 상태 코드. `0`는 성공을 나타냅니다. |
| data.file_token | 문자열 | 고유한 파일 식별자 |
| data.upload_url | 문자열 | 미리 서명된 업로드 URL. 클라이언트는 PUT를 사용하여 직접 파일을 업로드합니다. |
| data.expires_at | 문자열 | 자격 증명 만료 시간(ISO 8601) |
파일 관리
파일 업로드
POST /v3/files
Tripo 플랫폼에 파일을 업로드하고 후속 API 호출을 위해 file_token를 얻습니다.
요청 매개변수
요청 헤더
| 매개변수 |
유형 |
필수 |
기본값 |
설명 |
| Content-Type |
문자열 |
예 |
— |
multipart/form-data |
| Authorization |
문자열 |
예 |
— |
Bearer {api_key} |
요청 본문(multipart/form-data)
| 매개변수 |
유형 |
필수 |
기본값 |
설명 |
| file |
바이너리 |
예 |
— |
파일 데이터. 이미지는 JPEG/PNG, 최대 20개의 MB를 지원합니다. 모델은 GLB/GLTF/FBX/OBJ/STL, 최대 150개의 MB를 지원합니다. |
요청 예시
curl -X POST https://openapi.tripo3d.ai/v3/files \
-H "Authorization: Bearer {api_key}" \
-F "file=@/path/to/model.glb"
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())
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);
응답
성공적인 대응
{
"code": 0,
"data": {
"file_token": "file_abc123"
}
}
응답 필드
| 매개변수 |
유형 |
설명 |
| code |
정수 |
상태 코드. 0는 성공을 나타냅니다. |
| data.file_token |
문자열 |
후속 API 호출에 사용되는 고유 파일 식별자 |
업로드 자격 증명 받기
POST /v3/files/upload-credentials
클라이언트에서 클라우드 스토리지로 직접 대용량 파일을 업로드하려면 직접 업로드 자격 증명(STS)을 받으세요.
요청 매개변수
요청 헤더
| 매개변수 |
유형 |
필수 |
기본값 |
설명 |
| Content-Type |
문자열 |
예 |
— |
application/json |
| Authorization |
문자열 |
예 |
— |
Bearer {api_key} |
요청 예시
curl -X POST https://openapi.tripo3d.ai/v3/files/upload-credentials \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {api_key}"
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())
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);
응답
성공적인 대응
{
"code": 0,
"data": {
"file_token": "file_abc123",
"upload_url": "https://storage.example.com/upload/...",
"expires_at": "2025-01-01T01:00:00Z"
}
}
응답 필드
| 매개변수 |
유형 |
설명 |
| code |
정수 |
상태 코드. 0는 성공을 나타냅니다. |
| data.file_token |
문자열 |
고유한 파일 식별자 |
| data.upload_url |
문자열 |
미리 서명된 업로드 URL. 클라이언트는 PUT를 사용하여 직접 파일을 업로드합니다. |
| data.expires_at |
문자열 |
자격 증명 만료 시간(ISO 8601) |