Calls
Hang up a call
Currently, only WhatsApp one-to-one outbound 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.
https://api.unifyport.ai/v1/calls/{call_id}/hangupSupported channels
Before you call
Use a server-side X-Api-Key for the workspace that owns the resource. Replace every placeholder before running a sample.
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-KeyWorkspace API key. The workspace is resolved from this header.
Content-TypeUse application/json when sending a JSON request body.
Path parameters
call_idIdentifier used in the calls route.
maxLength: 128 · pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
Request body
account_idAccount 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_idCall identifier, also used to hang up.
maxLength: 128
stateCurrent call state.
enum: ended, failed
directionCall direction.
enum: inbound, outbound
media_typevoice for audio; video for a video-capable call.
enum: voice, video
Responses
200200 · 200
Request succeeded. See the example response body.
400Bad Request
The request body, path, or parameters are invalid.
401Unauthorized
The X-Api-Key header is missing or invalid.
403Forbidden
The request is authenticated but is not allowed.
404Not Found
The requested resource was not found. Check error.code and the current operation.
409Conflict
The requested operation conflicts with an existing provider account or resource.
500Internal Server Error
The service encountered an unexpected error.
501Not Implemented
The selected provider does not implement this operation.
502Bad Gateway
The provider adapter or upstream provider could not complete the operation.
503Service Unavailable
A required backend service is temporarily unavailable.
If the request fails
Inspect HTTP status and error.code/numeric_code; keep request_id. Check 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
Read HTTP status, error.code and error.numeric_code together in the context of the current operation. Numeric codes are strings. Keep request_id for diagnosis; it is not an idempotency key or a task identifier.
- invalid_request · 10000 · 400
Check the JSON body and required fields.
What to do: Correct the parameters for this operation and channel before requesting again. Repeating an unchanged invalid request will not resolve the error.
Illustrative JSON; message varies with the actual cause · 400 · 10000
{ "request_id": "req_example", "error": { "code": "invalid_request", "numeric_code": "10000", "message": "Invalid request parameters" } }- invalid_target_workspace · 11003 · 400
The workspace override target is empty or malformed. Remove the override header and use the API key belonging to the intended workspace.
When it occurs: Applies when the request includes the X-Workspace-Id workspace override header.
What to do: Correct the parameters for this operation and channel before requesting again. Repeating an unchanged invalid request will not resolve the error.
Illustrative JSON; message varies with the actual cause · 400 · 11003
{ "request_id": "req_example", "error": { "code": "invalid_target_workspace", "numeric_code": "11003", "message": "Invalid target workspace" } }- provider_invalid_request · 30001 · 400
Check the channel-specific fields and formats.
What to do: Correct the parameters for this operation and channel before requesting again. Repeating an unchanged invalid request will not resolve the error.
Illustrative JSON; message varies with the actual cause · 400 · 30001
{ "request_id": "req_example", "error": { "code": "provider_invalid_request", "numeric_code": "30001", "message": "Provider rejected the request" } }- invalid_api_key · 11001 · 401
Check whether the API key is correct and enabled.
What to do: Keep request_id and the structured codes, and investigate the current operation before taking another action.
Illustrative JSON; message varies with the actual cause · 401 · 11001
{ "request_id": "req_example", "error": { "code": "invalid_api_key", "numeric_code": "11001", "message": "Invalid API key" } }- missing_api_key · 11000 · 401
Add the X-Api-Key header.
What to do: Keep request_id and the structured codes, and investigate the current operation before taking another action.
Example · 401 · 11000
{ "request_id": "req_xxx", "error": { "code": "missing_api_key", "numeric_code": "11000", "message": "Missing X-Api-Key header" } }- workspace_override_forbidden · 11002 · 403
The request attempts a workspace override that this API key is not allowed to use. Remove the override header and use the API key belonging to the intended workspace.
When it occurs: Applies when the request includes the X-Workspace-Id workspace override header.
What to do: Keep request_id and the structured codes, and investigate the current operation before taking another action.
Example · 403 · 11002
{ "request_id": "req_example", "error": { "code": "workspace_override_forbidden", "numeric_code": "11002", "message": "Workspace override is not allowed" } }- 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.
What to do: Check the target identifier, resource ownership and current workspace. Do not treat a confirmed missing or inaccessible target as a temporary service failure to retry automatically.
Illustrative JSON; message varies with the actual cause · 404 · 20020
{ "request_id": "req_example", "error": { "code": "account_not_found", "numeric_code": "20020", "message": "Account not found" } }- call_not_found · 38003 · 404
The call does not exist under this account and workspace.
What to do: Check the target identifier, resource ownership and current workspace. Do not treat a confirmed missing or inaccessible target as a temporary service failure to retry automatically.
Example · 404 · 38003
{ "request_id": "req_example", "error": { "code": "call_not_found", "numeric_code": "38003", "message": "Call not found" } }- target_workspace_not_found · 11004 · 404
The overridden workspace was not found or is unavailable. Verify workspace ownership, remove the override header and use the intended workspace’s API key; repeated requests do not grant access.
When it occurs: Applies when the request includes the X-Workspace-Id workspace override header.
What to do: Check the target identifier, resource ownership and current workspace. Do not treat a confirmed missing or inaccessible target as a temporary service failure to retry automatically.
Illustrative JSON; message varies with the actual cause · 404 · 11004
{ "request_id": "req_example", "error": { "code": "target_workspace_not_found", "numeric_code": "11004", "message": "Target workspace not found" } }- account_binding_not_found · 30006 · 409
The account has no active channel connection binding; check its status.
What to do: Query authorization and runtime status, then choose refresh, start or reconnect only when appropriate for the intended state and channel. A connection problem alone does not prove logout. Confirm running before dependent business operations.
Illustrative JSON; message varies with the actual cause · 409 · 30006
{ "request_id": "req_example", "error": { "code": "account_binding_not_found", "numeric_code": "30006", "message": "Account is not bound to an available server" } }- call_already_active · 38000 · 409
The account already has a managed active call. Check the known call and the intended action; this error alone does not instruct you to end a call or repeatedly query the same failing operation.
What to do: Keep request_id and the structured codes, and investigate the current operation before taking another action.
Illustrative JSON; message varies with the actual cause · 409 · 38000
{ "request_id": "req_example", "error": { "code": "call_already_active", "numeric_code": "38000", "message": "Account already has an active call" } }- egress_configuration_pending · 20032 · 409
The platform default network configuration cannot currently be confirmed or loaded. This does not mean the account is logged out.
When it occurs: The operation uses platform-managed network capacity or a fixed default network configuration.
What to do: Keep request_id and check the account or creation result before another write. Wait for capacity or configuration recovery, or contact support. Do not repeatedly create accounts, change networks, or restart accounts automatically.
Illustrative JSON; message varies with the actual cause · 409 · 20032
{ "request_id": "req_example", "error": { "code": "egress_configuration_pending", "numeric_code": "20032", "message": "Account network configuration is pending verification" } }- provider_not_ready · 30009 · 409
The connection is not ready. Check authorization and runtime_status before retrying.
What to do: Query authorization and runtime status, then choose refresh, start or reconnect only when appropriate for the intended state and channel. A connection problem alone does not prove logout. Confirm running before dependent business operations.
Illustrative JSON; message varies with the actual cause · 409 · 30009
{ "request_id": "req_example", "error": { "code": "provider_not_ready", "numeric_code": "30009", "message": "Provider client is not ready" } }- provider_not_ready · 30014 · 409
The provider instance needed by this account is missing. This is a runtime availability problem, not proof that authorization expired.
What to do: Query authorization and runtime status, then choose refresh, start or reconnect only when appropriate for the intended state and channel. A connection problem alone does not prove logout. Confirm running before dependent business operations.
Channels: WhatsApp
Illustrative JSON; message varies with the actual cause · 409 · 30014
{ "request_id": "req_example", "error": { "code": "provider_not_ready", "numeric_code": "30014", "message": "Provider instance is missing" } }- provider_not_ready · 30015 · 409
The provider runtime is stopped. Confirm whether that is intentional before starting it; a stopped runtime does not itself mean logout.
What to do: Query authorization and runtime status, then choose refresh, start or reconnect only when appropriate for the intended state and channel. A connection problem alone does not prove logout. Confirm running before dependent business operations.
Channels: WhatsApp
Illustrative JSON; message varies with the actual cause · 409 · 30015
{ "request_id": "req_example", "error": { "code": "provider_not_ready", "numeric_code": "30015", "message": "Provider runtime is stopped" } }- call_control_failed · 30010 · 500
The provider could not complete the operation. message can include the original cause after “Provider operation failed:”; the reason text varies and is not a stable program interface.
When it occurs: Applies when the channel supplies no more specific failure classification; the current operation’s error is preserved.
What to do: Query the managed call and its call_id/state before creating or ending another call. Preparing is not dialing or answered; ended and failed are terminal states. A failed state alone is not a reason to repeat hangup.
Channels: WhatsApp
Illustrative JSON; message varies with the actual cause · 500 · 30010
{ "request_id": "req_example", "error": { "code": "call_control_failed", "numeric_code": "30010", "message": "Provider operation failed" } }- call_control_failed · 38004 · 500
The call could not be queried or ended. Check the current operation and call state.
What to do: Query the managed call and its call_id/state before creating or ending another call. Preparing is not dialing or answered; ended and failed are terminal states. A failed state alone is not a reason to repeat hangup.
Illustrative JSON; message varies with the actual cause · 500 · 38004
{ "request_id": "req_example", "error": { "code": "call_control_failed", "numeric_code": "38004", "message": "Failed to control call" } }- unsupported_by_provider · 30003 · 501
The channel does not support this operation; choose a supported operation.
What to do: Use a channel and action listed as supported. Repeating the same request does not add capabilities or grant beta access.
Example · 501 · 30003
{ "request_id": "req_xxx", "error": { "code": "unsupported_by_provider", "numeric_code": "30003", "message": "Operation not supported by this provider" } }- provider_adapter_not_found · 30004 · 502
The channel service is unavailable. Check status or try again later; confirm the result before retrying writes.
What to do: Query the managed call and its call_id/state before creating or ending another call. Preparing is not dialing or answered; ended and failed are terminal states. A failed state alone is not a reason to repeat hangup.
Illustrative JSON; message varies with the actual cause · 502 · 30004
{ "request_id": "req_example", "error": { "code": "provider_adapter_not_found", "numeric_code": "30004", "message": "Provider adapter unavailable" } }- provider_unavailable · 30002 · 502
The channel service is unavailable. Check status or try again later; confirm the result before retrying writes.
What to do: Query the managed call and its call_id/state before creating or ending another call. Preparing is not dialing or answered; ended and failed are terminal states. A failed state alone is not a reason to repeat hangup.
Example · 502 · 30002
{ "request_id": "req_example_provider_unavailable", "error": { "code": "provider_unavailable", "numeric_code": "30002", "message": "Provider service unavailable" } }- provider_unavailable · 30010 · 502
The provider could not complete the operation. message can include the original cause after “Provider operation failed:”; the reason text varies and is not a stable program interface.
What to do: Query the managed call and its call_id/state before creating or ending another call. Preparing is not dialing or answered; ended and failed are terminal states. A failed state alone is not a reason to repeat hangup.
Channels: WhatsApp
Example · 502 · 30010
{ "request_id": "req_example_operation_failed", "error": { "code": "provider_unavailable", "numeric_code": "30010", "message": "Provider operation failed: Example operation could not be completed" } }- call_service_unavailable · 38001 · 503
The calling service is unavailable. Check the Provider/Gateway connection and configuration.
What to do: Query the managed call and its call_id/state before creating or ending another call. Preparing is not dialing or answered; ended and failed are terminal states. A failed state alone is not a reason to repeat hangup.
Illustrative JSON; message varies with the actual cause · 503 · 38001
{ "request_id": "req_example", "error": { "code": "call_service_unavailable", "numeric_code": "38001", "message": "Call service unavailable" } }