> ## 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.

# 電話をかける

> 指定したAIエージェントで電話をかけます。発信キューに入った時点で `202` を返し、同時通話枠が空き次第かけます。
結果は「通話を取得する」か、Webhook の `call.ended` で受け取ります。
通話料は管理画面からの発信と同じです（1秒0.6円、不在10円、税抜）。




## OpenAPI

````yaml POST /calls
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:
  /calls:
    post:
      tags:
        - 通話
      summary: 電話をかける
      description: |
        指定したAIエージェントで電話をかけます。発信キューに入った時点で `202` を返し、同時通話枠が空き次第かけます。
        結果は「通話を取得する」か、Webhook の `call.ended` で受け取ります。
        通話料は管理画面からの発信と同じです（1秒0.6円、不在10円、税抜）。
      operationId: createCall
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            同じ発信の再送で二重に電話をかけないためのキー（英数字と `_ . :
            -`、200文字まで）。24時間、同じキーと同じ内容の再送には最初の結果を返します。
          schema:
            type: string
            maxLength: 200
            example: order-1024
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallCreate'
      responses:
        '202':
          description: 発信キューに入りました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallQueued'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - bearerAuth: []
components:
  schemas:
    CallCreate:
      type: object
      required:
        - agent_id
        - to
      properties:
        agent_id:
          type: string
          description: 使うAIエージェントのID
          example: 0123456789abcdef01234567
        to:
          type: string
          description: 発信先の日本の電話番号（フリーダイヤル等は不可）
          example: 090-1234-5678
        phone_number_id:
          type: string
          description: 発信元の電話番号のID。省略時はこのエージェントの発信番号、既定の発信番号、使える番号の順
        purpose:
          type: string
          maxLength: 500
          description: 今回の電話の目的（通話記録に残ります）
          example: 資料請求のお礼と面談のご案内
        contact:
          type: object
          description: この通話だけの相手の情報
          properties:
            name:
              type: string
              maxLength: 120
              example: 山田
            company:
              type: string
              maxLength: 120
              example: 株式会社サンプル
            email:
              type: string
              format: email
              example: yamada@example.com
        variables:
          type: object
          description: 会話で使う項目（英数字の名前40文字・値500文字、50個まで）
          additionalProperties:
            type: string
            maxLength: 500
          example:
            plan: スタンダード
        metadata:
          type: object
          description: 通話とWebhookにそのまま返す自由な値（英数字の名前40文字・値500文字、20個まで）
          additionalProperties:
            type: string
            maxLength: 500
          example:
            crm_id: A-1024
    CallQueued:
      type: object
      properties:
        id:
          type: string
          description: 通話のID
        status:
          type: string
          const: queued
        to:
          type: string
          example: '+819012345678'
        from:
          type: string
          example: '+815012345678'
        agent:
          $ref: '#/components/schemas/AgentRef'
        metadata:
          type: object
          additionalProperties:
            type: string
    AgentRef:
      type:
        - object
        - 'null'
      properties:
        id:
          type: string
        name:
          type:
            - string
            - 'null'
    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'
    PaymentRequired:
      description: >-
        契約・カード・残高が足りません（`subscription_required` `payment_method_required`
        `insufficient_credit`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: このAPIキーに必要な権限がありません（`insufficient_scope`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: >-
        見つかりません（`not_found` `call_not_found` `agent_not_found`
        `webhook_not_found`）。
      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'
    IdempotencyKeyReused:
      description: この Idempotency-Key は別の内容のリクエストに使われています（`idempotency_key_reused`）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: 回数の上限を超えました（`rate_limited`）。少し待って再試行してください。
      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.