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

# Accept Call

> Answer a ringing call. Either send your SDP answer to the offer from the call webhook (the audio then flows between WhatsApp and your media server), or send `stream` and FlowIQ answers the call itself and streams the audio to your WebSocket (see Media stream). Scope: send.

Answer a ringing call. Either send your SDP answer to the offer from the [`call` webhook](https://docs.flowapt.com/flowiq-api-reference/webhooks#call), after which the audio flows between WhatsApp and your media server, or send `stream` and FlowIQ answers the call itself and streams the audio to your WebSocket ([media stream](https://docs.flowapt.com/flowiq-api-reference/calling.md#stream-the-audio-to-your-own-voice-agent)). If FlowIQ staff have the inbox open, they see the call as answered on another device.

## Basic Usage

```bash theme={null}
curl -X POST "https://api.flowiq.live/v1/calls/accept" \
  -H "Authorization: Bearer fiq_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"call_id": "wacid.HBgLMjc4MjAwMDAwMDAVAgARGBI2RjQ3QkU1RjA5Q0UyMkEzQjQA", "sdp": "v=0\r\no=- 4611 2 IN IP4 127.0.0.1\r\n…"}'
```

***

## Body Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `call_id` | string | Yes | From the `call` webhook (`call.id`) |
| `sdp` | string | One of `sdp` / `stream` | Your SDP answer to the offer in `call.session.sdp` |
| `stream` | object | One of `sdp` / `stream` | `{ url: "wss://…", format?, headers?, custom_parameters? }`: FlowIQ answers and streams the audio there. `format` is `pcm16_16k` (default), `pcm16_8k`, `pcm16_24k` or `mulaw_8k` |
| `biz_opaque_callback_data` | string | No | With `sdp` only. Your own reference (max 512 characters); WhatsApp sends it back on later events for this call |

***

## Response

### Success (200)

```json theme={null}
{
  "organization_id": "a4234f32-…",
  "success": true,
  "call_id": "wacid.HBgLMjc4MjAwMDAwMDAVAgARGBI2RjQ3QkU1RjA5Q0UyMkEzQjQA",
  "action": "accept"
}
```

***

## Errors

| Status | When |
| - | - |
| `400` | `call_id`, or both `sdp` and `stream`, missing (`validation_error`), or WhatsApp refused the action (`whatsapp_rejected`; the `message` says why, e.g. `Parameter value is not valid` for an unknown or finished call) |
| `409` | With `stream`: the call is no longer ringing (`call_not_ringing`) |
| `401` | Missing or invalid API key |
| `403` | The key has no `send` scope |

With `stream`, a WebSocket endpoint that does not accept the connection within 8 seconds fails the request (`validation_error`, the message names the reason) and the call keeps ringing.

WhatsApp gives you a limited time to answer before the call rings out; accept as soon as your media server has the answer ready.


## OpenAPI

````yaml flowiq-api-reference/openapi-calls.json POST /v1/calls/accept
openapi: 3.1.0
info:
  title: FlowIQ Calling API
  version: 1.0.0
  description: >-
    Run WhatsApp calls on your FlowIQ number from your own server: answer,
    decline, end and start calls, ask for call permission, read call history and
    change the number's calling settings. Every response carries X-Request-Id;
    errors carry a stable code; POST / PATCH accept Idempotency-Key.
servers:
  - url: https://api.flowiq.live
    description: FlowIQ Production API
security:
  - BearerAuth: []
paths:
  /v1/calls/accept:
    post:
      tags:
        - Calling
      summary: Accept Call
      description: >-
        Answer a ringing call. Either send your SDP answer to the offer from the
        call webhook (the audio then flows between WhatsApp and your media
        server), or send `stream` and FlowIQ answers the call itself and streams
        the audio to your WebSocket (see Media stream). Scope: send.
      operationId: acceptCall
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                call_id:
                  type: string
                  description: The call's id from the call webhook
                  example: wacid.HBgLMjc4MjAwMDAwMDAVAgARGBI2RjQ3QkU1RjA5Q0UyMkEzQjQA
                sdp:
                  type: string
                  description: >-
                    Your SDP answer to the offer in call.session.sdp (leave out
                    when you send stream)
                biz_opaque_callback_data:
                  type: string
                  maxLength: 512
                  description: >-
                    Your own reference; WhatsApp sends it back on later events
                    for this call
                stream:
                  $ref: '#/components/schemas/StreamConfig'
              required:
                - call_id
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization_id:
                    type: string
                    format: uuid
                  success:
                    type: boolean
                  call_id:
                    type: string
                  action:
                    type: string
                    enum:
                      - pre_accept
                      - accept
                      - reject
                      - terminate
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: The call is no longer ringing (code call_not_ringing); stream only
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    StreamConfig:
      type: object
      description: >-
        Have FlowIQ answer the call and stream its audio to your WebSocket
        (media stream), instead of answering with sdp
      required:
        - url
      properties:
        url:
          type: string
          example: wss://agent.example.com/flowiq/stream
          description: Your WebSocket endpoint (wss:// only)
        format:
          type: string
          enum:
            - pcm16_16k
            - pcm16_8k
            - pcm16_24k
            - mulaw_8k
          default: pcm16_16k
          description: >-
            Audio format on the socket, both directions. mulaw_8k matches Twilio
            Media Streams
        headers:
          type: object
          additionalProperties:
            type: string
          description: Headers FlowIQ sends when it connects, e.g. Authorization
        custom_parameters:
          type: object
          description: Echoed in the start message (max 4 KB)
    Error:
      type: object
      properties:
        error:
          type: string
          description: Short label (Bad request, Not found, …)
        code:
          type: string
          description: Stable machine-readable code, see Conventions
        message:
          type: string
        request_id:
          type: string
          format: uuid
          description: Quote this to support
        whatsapp_error_code:
          type: integer
          description: WhatsApp's own code, on whatsapp_rejected
  responses:
    BadRequest:
      description: Invalid request, or WhatsApp refused it (the message says why)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Request failed
            message: Parameter value is not valid
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key lacks the scope, or the person has not given call permission
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Request failed
            message: Contact has not granted callback permission
    RateLimited:
      description: 240 reads or 60 actions per minute per key; Retry-After says when
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: fiq_ API key
      description: >-
        Your FlowIQ organisation API key (Settings → API Keys), sent as a bearer
        token. Format: `Bearer fiq_YOUR_API_KEY`

````

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