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

# 送信先を追加する

> 通話の結果を受け取るURLを追加します。署名用のシークレット（`secret`）はこの応答でだけ返ります。1アカウント5件まで。



## OpenAPI

````yaml POST /webhooks
openapi: 3.1.0
info:
  title: AIコール API
  version: '1.0'
  description: 自社のシステムからAIエージェントで電話をかけ、通話の結果を受け取るためのAPIです。
servers:
  - url: https://api.ai-call.co
security:
  - bearerAuth: []
tags:
  - name: 通話
  - name: エージェント・電話番号
  - name: Webhook
paths:
  /webhooks:
    post:
      tags:
        - Webhook
      summary: 送信先を追加する
      description: 通話の結果を受け取るURLを追加します。署名用のシークレット（`secret`）はこの応答でだけ返ります。1アカウント5件まで。
      operationId: createWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  description: 外部から届く `https://` のURL
                  example: https://example.com/webhooks/ai-call
                events:
                  type: array
                  description: 受け取るイベント（省略時は両方）
                  items:
                    type: string
                    enum:
                      - call.ended
                      - call.failed
      responses:
        '201':
          description: 追加しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCreated'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  schemas:
    WebhookCreated:
      allOf:
        - $ref: '#/components/schemas/Webhook'
        - type: object
          properties:
            secret:
              type: string
              description: 署名用のシークレット（この応答でだけ返ります）
              example: whsec_…
    Webhook:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        events:
          type: array
          items:
            type: string
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: 機械で判断するための英字のコード
              example: do_not_call
            message:
              type: string
              description: 日本語の説明
              example: この番号は架電しない設定です。
  responses:
    BadRequest:
      description: >-
        入力が正しくありません（`invalid_request` `invalid_json` `invalid_number`
        `invalid_email` `invalid_url` `invalid_cursor`
        `idempotency_key_required`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: APIキーがないか無効です（`missing_api_key` `invalid_api_key`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: このAPIキーに必要な権限がありません（`insufficient_scope`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >-
        今は実行できません（`do_not_call` `contact_paused` `outside_calling_hours`
        `agent_not_ready` `phone_number_not_found` `idempotency_in_progress`
        `too_many_webhooks`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 管理画面「設定 → API」で作成したAPIキー（`aic_sk_…`）。

````

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