> For the complete documentation index, see [llms.txt](https://developer.mixeder.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.mixeder.net/biz-ai/cloudimageclassfyapi.md).

# CloudImageClassfyAPI

**CloudImageClassfyAPI** は、画像分類機能を提供する API です。指定した画像を AI モデルで解析し、ラベルやカテゴリを返します。簡単なインターフェースで、高精度な画像分類を実現します。

***

#### **導入用途**

1. **画像データの自動分類**\
   商品画像、ユーザー投稿画像、またはストック画像を自動分類します。
2. **コンテンツモデレーション**\
   アップロードされた画像に不適切な内容が含まれていないかを確認します。
3. **視覚データ分析**\
   サービスのインサイトを得るために画像データを解析します。
4. **画像認識システムの構築**\
   画像検索や画像分類を含むアプリケーションのバックエンドとして利用します。

***

#### **Base URL**

```
https://cloudimageclass-mixederapi.mixeder.com/
```

***

#### **Endpoints**

**GET /**

画像データを指定して分類タスクを実行します。

**Headers**

| ヘッダー名          | 必須 | 説明                 |
| -------------- | -- | ------------------ |
| `Content-Type` | はい | `application/json` |

**Query Parameters**

| パラメーター名    | 必須 | 説明          |
| ---------- | -- | ----------- |
| `key`      | はい | 使用する API キー |
| `imageurl` | はい | 解析する画像の URL |

**Response**

* 成功時:\
  **HTTP Status**: 200\
  **Body**:

  ```json
  {
    "message": "API authentication, image processing, and billing completed successfully",
    "username": "user",
    "response": [
      {
        "label": "BARRACOUTA",
        "score": 0.44505077600479126
      },
      {
        "label": "GAR",
        "score": 0.27577465772628784
      },
      {
        "label": "COHO",
        "score": 0.12319006025791168
      },
      {
        "label": "ELECTRIC RAY",
        "score": 0.03162669017910957
      },
      {
        "label": "HAMMERHEAD SHARK",
        "score": 0.0204053595662117
      }
    ],
    "billingResponse": "{\"status\":\"success\"}"
  }
  ```
* エラー時:\
  **HTTP Status**: 400 または 500\
  **Body**:

  ```json
  {
    "error": "Error message"
  }
  ```

***

#### **サンプルコード**

**JavaScript Fetch Example**

```javascript
async function classifyImage(apiKey, imageUrl) {
  const apiUrl = 'https://cloudimageclass-mixederapi.mixeder.com/';
  
  const queryParams = new URLSearchParams({ key: apiKey, imageurl: imageUrl });
  
  try {
    const response = await fetch(`${apiUrl}?${queryParams.toString()}`, {
      method: 'GET',
      headers: { 'Content-Type': 'application/json' },
    });

    if (!response.ok) {
      throw new Error(`API error: ${response.statusText}`);
    }

    const data = await response.json();
    console.log('Image classification result:', data.response);
    return data.response;
  } catch (error) {
    console.error('Error during image classification:', error.message);
    throw error;
  }
}

// 使用例
classifyImage('your-api-key', 'https://example.com/image.jpg')
  .then((result) => console.log('Classification Result:', result))
  .catch((err) => console.error('Classification failed:', err));
```

***

**Python Requests Example**

```python
import requests

def classify_image(api_key, image_url):
    api_url = 'https://cloudimageclass-mixederapi.mixeder.com/'
    params = {
        "key": api_key,
        "imageurl": image_url,
    }
    try:
        response = requests.get(api_url, params=params)
        response.raise_for_status()
        data = response.json()
        print("Image classification result:", data["response"])
        return data["response"]
    except requests.exceptions.RequestException as e:
        print("Error during image classification:", e)
        raise

# 使用例
classify_image("your-api-key", "https://example.com/image.jpg")
```

***

**cURL Example**

```bash
curl -X GET 'https://cloudimageclass-mixederapi.mixeder.com/?key=your-api-key&imageurl=https://example.com/image.jpg' \
  -H "Content-Type: application/json"
```

***

このリファレンスを活用することで、CloudImageClassfyAPI を簡単に統合し、画像データの分類を効率的に実現できます。
