API Reference

Calls

Hang up a callbeta

This feature is in private beta. Contact technical support to request access for your workspace.

Currently, only WhatsApp one-to-one voice and video calls are supported. Use account_id and call_id to end the call. If the ID was lost, query the active-call endpoint first.

POSThttps://api.unifyport.ai/v1/calls/{call_id}/hangup

Supported channels

WhatsApp

Before you call

Use a server-side X-Api-Key for the workspace that owns the resource. Replace every placeholder before running a sample.

Confirm that the workspace has private-beta access. Before creating a call, complete WhatsApp authorization and check runtime_status=running. Use the conversation_id of a private conversation under this account.

Prepare your parameters
account_id
Use data.id from account creation or an account query. Account identifiers belong to the workspace selected by X-Api-Key. Get account
call_id
Use call_id returned by call creation or the active-call query for this account. If it was lost, query the active call before hanging up. Get the active call

Request parameters

Headers

X-Api-Key
stringrequired

Workspace API key. The workspace is resolved from this header.

Content-Type
stringrequired

Use application/json when sending a JSON request body.

Path parameters

call_id
stringrequired

Identifier used in the calls route.

maxLength: 128 · pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$

Request body

account_id
stringrequired

Account ID in this workspace.

pattern: ^acc_[A-Za-z0-9][A-Za-z0-9_-]*$

Understand the result

Read the returned call_id and state. ended and failed are both terminal call states; a repeated hangup may return the existing terminal state. HTTP 200 does not require state=ended, and state=failed is not a reason to retry automatically.

Response 200 · 200

{
  "request_id": "req_example",
  "data": {
    "call_id": "call_example",
    "state": "ended",
    "direction": "outbound",
    "media_type": "voice"
  }
}

Response body

call_id
string

Call identifier, also used to hang up.

maxLength: 128

state
string

Current call state.

enum: ended, failed

direction
string

Call direction.

enum: inbound, outbound

media_type
string

voice for audio; video for a video-capable call.

enum: voice, video

Responses

200

200 · 200

Request succeeded. See the example response body.

400

Bad Request

The request body, path, or parameters are invalid.

401

Unauthorized

The X-Api-Key header is missing or invalid.

403

Forbidden

The request is authenticated but is not allowed.

404

Not Found

The requested resource was not found. Check error.code and the current operation.

409

Conflict

The requested operation conflicts with an existing provider account or resource.

500

Internal Server Error

The service encountered an unexpected error.

501

Not Implemented

The selected provider does not implement this operation.

502

Bad Gateway

The provider adapter or upstream provider could not complete the operation.

503

Service Unavailable

A required backend service is temporarily unavailable.

If the request fails

Inspect HTTP status and error.code/numeric_code; keep request_id. Check private-beta access, the account and call_id. On a creation conflict, query the active call first. Check the current call before retrying creation or hangup. Error reference

invalid_request · 10000 · 400
Check required fields, formats and channel conditions, then correct the request.
missing_api_key · 11000 · 401
Check X-Api-Key and whether the workspace is active.
invalid_api_key · 11001 · 401
Check X-Api-Key and whether the workspace is active.
account_not_found · 20020 · 404
Check account_id and use an X-Api-Key for the workspace that owns the account. An account not found in this workspace cannot be accessed with this key.
unsupported_by_provider · 30003 · 501
Check the channel capability guide and choose a supported channel or action. Repeating the request does not add support.
beta_feature_not_enabled · 41002 · 403
Contact technical support to request private-beta access for the workspace. Repeating the request or changing is_beta in a request does not grant access.
call_not_found · 38003 · 404
Inspect HTTP status and error.code/numeric_code; keep request_id. Check private-beta access, the account and call_id. On a creation conflict, query the active call first. Check the current call before retrying creation or hangup.