---
title: ファイルアップロードを作成する | RunAPI
description: 1つのローカルファイル、リモートHTTPS URL、またはbase64ソースをアップロードし、一時的なURLを受け取ります。
url: https://runapi.ai/ja/docs/api/files/create.md
canonical: https://runapi.ai/ja/docs/api/files/create
locale: ja
---

> HTML 版: https://runapi.ai/ja/docs/api/files/create
> エージェント向けサイトインデックス: https://runapi.ai/llms.txt

# ファイルアップロードを作成する

1つのローカルファイル、リモートHTTPS URL、またはbase64ソースをアップロードし、一時的なURLを受け取ります。

## エンドポイント

POST /api/v1/files

ベースURL: https://runapi.ai

API バージョン: v1

認証: Authorization: Bearer YOUR_API_KEY

## リクエスト

指定されたリクエストの場所にのみ値を送信してください。

### application/json - Base64 source

```json
{
  "file_name": {
    "description": "作成されるファイルアップロードのオプションのファイル名。",
    "required": false,
    "type": "string"
  },
  "source": {
    "description": "Base64エンコードされたソースバイト。",
    "properties": {
      "data": {
        "description": "Base64データ",
        "required": true,
        "type": "string"
      },
      "type": {
        "description": "base64ソース表現を選択します。",
        "required": true,
        "type": "string"
      }
    },
    "required": true,
    "type": "object"
  }
}
```

### application/json - URL source

```json
{
  "file_name": {
    "description": "作成されるファイルアップロードのオプションのファイル名。",
    "required": false,
    "type": "string"
  },
  "source": {
    "description": "ダウンロード元のリモート HTTPS ソース。",
    "properties": {
      "type": {
        "description": "URLソース表現を選択します。",
        "required": true,
        "type": "string"
      },
      "url": {
        "description": "ダウンロード用の公開 HTTPS URL。",
        "format": "uri",
        "required": true,
        "type": "string"
      }
    },
    "required": true,
    "type": "object"
  }
}
```

### multipart/form-data

```json
{
  "file": {
    "description": "アップロードするローカルファイルのバイト列。",
    "format": "binary",
    "required": true,
    "type": "string"
  },
  "file_name": {
    "description": "作成されるファイルアップロードのオプションのファイル名。",
    "required": false,
    "type": "string"
  }
}
```

## 成功レスポンス

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"
}
```

## エラーレスポンス (401)

HTTP 401

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Authentication required"
}
```

## エラーレスポンス (403)

HTTP 403

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Standard API key required"
}
```

## エラーレスポンス (400)

HTTP 400

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Only HTTPS URLs are allowed"
}
```

## エラーレスポンス (408)

HTTP 408

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Download timeout"
}
```

## エラーレスポンス (413)

HTTP 413

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "File size exceeds the maximum allowed size"
}
```

## エラーレスポンス (415)

HTTP 415

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "This content type is not supported"
}
```

## エラーレスポンス (422)

HTTP 422

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "File upload failed. Please try again."
}
```

## エラーレスポンス (429)

HTTP 429

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

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

## cURLの例



### curl

```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"}'
```

## 関連リファレンス

- [ファイル](https://runapi.ai/ja/docs/api/files.md)
- [File Uploadオブジェクト](https://runapi.ai/ja/docs/api/files/object.md)

---

## RunAPI のその他の情報

- [ホーム](https://runapi.ai/ja/.md)
- [モデルカタログ](https://runapi.ai/ja/models.md)
- [料金](https://runapi.ai/ja/pricing.md)
- [プロバイダー](https://runapi.ai/ja/models)
- [ドキュメント](https://runapi.ai/ja/docs/guides)
- [SDK](https://runapi.ai/ja/sdk.md)
- [CLI](https://runapi.ai/ja/cli.md)
- [MCP Server](https://runapi.ai/ja/mcp.md)
- [Claude Code と Cursor](https://runapi.ai/ja/claude-code-vs-cursor.md)
- [Cursor API セットアップ](https://runapi.ai/ja/cursor-api-setup.md)
- [RunAPI と OpenRouter の比較](https://runapi.ai/ja/openrouter-alternative.md)
- [エンタープライズ](https://runapi.ai/ja/contact.md)
- [お問い合わせ](https://runapi.ai/ja/contact.md)
- [利用規約](https://runapi.ai/ja/terms.md)
- [プライバシー](https://runapi.ai/ja/privacy.md)
- [エージェント向けサイトインデックス](https://runapi.ai/llms.txt)

お問い合わせ: contact@runapi.ai

## 構造化データ

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ja/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/jaicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "TechArticle",
    "headline": "ファイルアップロードを作成する",
    "description": "1つのローカルファイル、リモートHTTPS URL、またはbase64ソースをアップロードし、一時的なURLを受け取ります。",
    "url": "https://runapi.ai/ja/docs/api/files/create",
    "mainEntityOfPage": "https://runapi.ai/ja/docs/api/files/create"
  }
]
```
