> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contentcare.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhookを作成 (v3)

> 空でも重複でもないsubscribedEventsの一覧を指定して登録します。対応する値はevent-typesで取得できます。テストキーではisTest=trueが強制され、falseを明示するとAUTH_FORBIDDENになります。登録レスポンスには署名用secretが含まれます。安全に保管してください。詳細取得でも確認できます。

```bash cURL theme={null}
curl -X POST "$CONTENTCARE_API_BASE_URL/api/v3/orders/webhooks" \
  -H "Authorization: Bearer $CONTENTCARE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"ContentCare webhook","url":"https://your-server.com/webhook","subscribedEvents":["order.watermarkEmbed.completed","order.watermarkEmbed.failed"]}'
```

```javascript Node.js theme={null}
const response = await fetch(`${process.env.CONTENTCARE_API_BASE_URL}/api/v3/orders/webhooks`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CONTENTCARE_API_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "ContentCare webhook",
    url: "https://your-server.com/webhook",
    subscribedEvents: ["order.watermarkEmbed.completed", "order.watermarkEmbed.failed"],
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const webhook = await response.json(); // signing secret: webhook.data.secret
```

```python Python theme={null}
import os
import requests

response = requests.post(
    f"{os.environ['CONTENTCARE_API_BASE_URL']}/api/v3/orders/webhooks",
    headers={"Authorization": f"Bearer {os.environ['CONTENTCARE_API_TOKEN']}"},
    json={
        "name": "ContentCare webhook",
        "url": "https://your-server.com/webhook",
        "subscribedEvents": ["order.watermarkEmbed.completed", "order.watermarkEmbed.failed"],
    },
    timeout=30,
)
response.raise_for_status()
webhook = response.json()  # signing secret: webhook["data"]["secret"]
```


## OpenAPI

````yaml ja/api-reference/openapi.yaml POST /api/v3/orders/webhooks
openapi: 3.0.0
info:
  title: ContentCare API
  version: 2.0.0
  description: >-
    ContentCare API は、デジタルコンテンツ保護のための4つのコアサービスを提供します:

    - **Anti-AI**: 画像をAI学習から保護

    - **Watermark Embed**: 画像に不可視のデジタル watermark を埋め込み

    - **Watermark Extract**: 画像から watermark を抽出・検証

    - **AI Detection**: 画像がAI生成かどうかを検知

    - **テストAPIキー**: `sk_test_`
    プレフィックスのキーは同じBearer認証を使用し、実際の処理サービスの実行やクレジットの消費なしに注文ライフサイクルを検証できます。テストアップロードの内容は破棄され、結果ファイルは作成されません
  contact:
    name: ContentCare サポート
    email: support@contentcare.ai
  license:
    name: Proprietary
    url: https://docs.contentcare.ai/legal/terms
servers:
  - url: https://api.bizmori.com
    description: 本番環境
security: []
tags:
  - name: Anti-AI
    description: Anti-AI画像保護の注文
  - name: Watermark Embed
    description: watermark 埋め込みの注文
  - name: Watermark Extract
    description: watermark 抽出の注文
  - name: AI Detection
    description: AI生成画像検知の注文
  - name: Orders
    description: 注文の照会と管理
  - name: Webhooks
    description: Webhookの設定とイベント
  - name: Reports
    description: watermark 抽出・AI Detection 注文の PDF 分析レポート
paths:
  /api/v3/orders/webhooks:
    post:
      tags:
        - Webhooks
      summary: Webhookを作成 (v3)
      description: >-
        空でも重複でもないsubscribedEventsの一覧を指定して登録します。対応する値はevent-typesで取得できます。テストキーではisTest=trueが強制され、falseを明示するとAUTH_FORBIDDENになります。登録レスポンスには署名用secretが含まれます。安全に保管してください。詳細取得でも確認できます。
      operationId: createWebhookV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookV3CreateRequest'
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WebhookV3Endpoint'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: 同じアカウントで正規化したURLが重複しています
      security:
        - BearerAuth: []
components:
  schemas:
    WebhookV3CreateRequest:
      allOf:
        - $ref: '#/components/schemas/WebhookCreateRequest'
        - type: object
          required:
            - subscribedEvents
          properties:
            subscribedEvents:
              type: array
              minItems: 1
              uniqueItems: true
              items:
                type: string
                enum:
                  - order.antiAi.completed
                  - order.antiAi.failed
                  - order.watermarkEmbed.completed
                  - order.watermarkEmbed.failed
                  - order.watermarkExtract.completed
                  - order.watermarkExtract.failed
                  - order.aiDetection.completed
                  - order.aiDetection.failed
              description: 必須です。空の一覧や重複するイベントは指定できません。
    WebhookV3Endpoint:
      type: object
      properties:
        webhookId:
          type: integer
        name:
          type: string
        url:
          type: string
          format: uri
        secret:
          type: string
          description: 登録と詳細取得のレスポンスだけに含まれます。
        isTest:
          type: boolean
        isActive:
          type: boolean
        subscribedEvents:
          type: array
          items:
            type: string
        lastSentAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    WebhookCreateRequest:
      type: object
      required:
        - url
      properties:
        name:
          type: string
          maxLength: 100
          description: Webhook名（識別用）
        url:
          type: string
          format: uri
          description: Webhookエンドポイント URL
          example: https://example.com/webhook
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: エラーコード
  responses:
    Unauthorized:
      description: 認証失敗
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: AUTH_NOT_AUTHENTICATED
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        外部クライアントアクセス用のBearer APIキー。本番キーは `sk_` プレフィックスを使用し、テストキーは `sk_test_`
        プレフィックスを使用して、処理やクレジット消費なしに注文ライフサイクルを検証します。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.