API Reference

Accounts

Create account

Creates a provider account. auth_mode is required and must be qrcode, code, or session. When a provider/auth_mode pair requires a phone number (for example WhatsApp with auth_mode=code), supply provider_data.phone here; it is persisted and replayed for later authentication actions. Create a wallet-mode account directly; no quote request is needed. A 201 commits creation and debit; check billing.state before authorization. Concurrent creation in the same workspace returns 409 wallet_account_creation_in_progress. Idempotency-Key is optional; after a timeout, reconcile first, since only retrying with the original key prevents a second purchase.

POSThttps://api.unifyport.ai/v1/accounts

Supported channels

all

Before you call

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

Use the intended workspace API Key. Wallet-mode accounts are billed in USD for 30 days. View your wallet balance and top up in the Dashboard.

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.

Idempotency-Key
string

Optional for wallet creation. Preserve the same key for unknown-result retries; without one, another request after completion creates a new account.

Request body

name
string

Human-readable account name.

provider
stringrequired

Customer provider identifier: telegram, whatsapp, whatsapp-protocol, line, twitter, zalo, or tiktok.

enum: telegram, whatsapp, line, twitter, zalo, tiktok, whatsapp-protocol, x, x_client, twitter_client

region
stringrequired

Provider region used for allocation. Pick a region reported as allocatable: true by List provider regions.

minLength: 1

status
string

Account business state, such as active or inactive.

runtime_status
string

Requested runtime state when the provider supports changing it through account configuration.

enum: unknown, starting, running, stopping, stopped, reconnecting, disconnected, error

auth_mode
stringrequired

Required when creating an account. Authentication flow: qrcode, code, or session.

enum: qrcode, code, session

capabilities[]
string[]

Capabilities enabled for this account. On PATCH, omit to retain or send [] to clear; null is invalid.

metadata
object

Platform-side metadata. On PATCH, omit to retain or send {} to clear; null is invalid.

provider_account_ref
string

Channel-side account identity, normally populated after authorization.

provider_data
object

Provider configuration. On PATCH, omit to retain; {} clears without adding default credentials; null is invalid. TikTok provider_data.enable_comment accepts only Boolean, default false; strings, numbers and null return 400 invalid_request. Online changes require reconnect; successful start does not prove application, and disabling does not retract queued events. Telegram api_id and api_hash are optional for code, qrcode and session; custom credentials must be paired strings from the same app. Creation without custom credentials and omitted credentials in a non-empty replacement use platform defaults; unavailable required defaults fail the request. Changing platform defaults does not replace existing account credentials. Keep secrets out of logs.

proxy
object

Optional outbound proxy configuration for this account.

Understand the result

Create a wallet-mode account directly; no quote request is needed. A 201 commits creation and debit; check billing.state before authorization. Concurrent creation in the same workspace returns 409 wallet_account_creation_in_progress. Idempotency-Key is optional; after a timeout, reconcile first, since only retrying with the original key prevents a second purchase.

Response 201 · PREPAID_QUOTA

{
  "request_id": "<REQUEST_ID>",
  "data": {
    "id": "acc_example",
    "name": "Telegram Production",
    "provider": "telegram",
    "region": "<REGION>",
    "status": "active",
    "runtime_status": "stopped",
    "auth_mode": "qrcode",
    "capabilities": [
      "send_message",
      "receive_message"
    ]
  }
}

Response 201 · ACCOUNT_WALLET_30D

{
  "request_id": "<REQUEST_ID>",
  "data": {
    "id": "acc_example",
    "name": "Messaging account",
    "provider": "telegram",
    "region": "<REGION>",
    "status": "active",
    "runtime_status": "stopped",
    "auth_mode": "qrcode",
    "capabilities": [
      "send_message",
      "receive_message"
    ],
    "billing": {
      "period_start_at": "2026-10-19T00:00:00Z",
      "period_end_at": "2026-11-18T00:00:00Z",
      "amount_minor": 1000,
      "currency": "USD",
      "operation_id": "op_example",
      "state": "ACTIVE"
    }
  }
}

Response body

provider_profile
object

Channel-reported profile such as display_name. Omitted before the account is authenticated.

id
string

Channel-side account identity. WhatsApp returns an LID; it may be omitted before profile synchronization completes.

device_id
integer

Login device number, optionally returned in WhatsApp account details when the current session can be identified. It may change after reauthorization and is not a permanent device identifier.

minimum: 0 · maximum: 65535

phone
string

Normalized account phone number with spaces, hyphens, and the leading plus sign removed.

username
string

Provider-reported username, when available.

display_name
string

Account display name; for WhatsApp this is generated by preferring BusinessName and falling back to PushName.

push_name
string

PushName currently set on the WhatsApp account; other providers do not define semantics for this field.

business_name
string

WhatsApp BusinessName; omitted when the provider does not return one.

first_name
string

Provider-reported first name, when available.

last_name
string

Provider-reported last name, when available.

avatar_url
string

Provider-reported account avatar URL, when available.

bio
string

Provider-reported account biography or status text, when available.

platform
string

Login platform identifier reported by WhatsApp during pairing. Treat it as an opaque string and accept unknown values; other providers do not define this field. It is distinct from device_platform.

billing
object

Paid period, present only for wallet accounts. Wallet balance does not prove purchase.

period_start_at
string

Server paid period start.

format: date-time

period_end_at
string

Server paid period end.

format: date-time

amount_minor
integer

Immutable server amount in USD cents; use exact integers.

minimum: 1 · format: int64

currency
string

USD only.

operation_id
string

Public ID from billing.operation_id or a deletion response; reuse unchanged within the original workspace.

state
string

Billing or operation state does not prove authorization, connection or refund credit.

enum: ACTIVE, DELETING, DELETED, COMPENSATED, REVIEW

id
string

Unique account identifier (acc_...). Use it in account-scoped routes.

name
string

Human-readable account name.

provider
string

Channel identifier. Use the API value unchanged in later calls; see the enum below for the values returned by this endpoint.

enum: telegram, whatsapp, line, twitter, zalo, tiktok, whatsapp-protocol

region
string

Provider region the account is allocated to.

status
string

Account lifecycle state, such as active.

runtime_status
string

Normalized runtime state: one of unknown, starting, running, stopping, stopped, reconnecting, disconnected, or error.

enum: unknown, starting, running, stopping, stopped, reconnecting, disconnected, error

auth_mode
string

Authentication flow used by the account: code, qrcode, or session.

capabilities[]
string[]

Capabilities enabled for the account, such as send_message and receive_message.

metadata
object

Your own environment labels stored on the account.

provider_account_ref
string

Channel-side identifier you can attach to correlate the account with your own system.

proxy
object

Outbound proxy configuration attached to the account, when configured.

Responses

201

201 Created

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.

503

Service Unavailable

A required backend service is temporarily unavailable.

If the request fails

Inspect HTTP status and error.code/numeric_code, and keep request_id for diagnosis. Correct invalid parameters, complete required authorization or check runtime state as appropriate. Confirm the outcome before retrying a send or another write. 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.

auth_mode_phone_required · 20019 · 400

Provide provider_data.phone when creating the account for this authorization mode.

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 · 20019
{
  "request_id": "req_example",
  "error": {
    "code": "auth_mode_phone_required",
    "numeric_code": "20019",
    "message": "Phone number is required for this auth mode"
  }
}
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"
  }
}
unsupported_provider_auth_mode · 20018 · 400

Choose an auth_mode supported by this channel.

What to do: Use a channel and action listed as supported. Repeating the same request does not add capabilities or grant beta access.

Illustrative JSON; message varies with the actual cause · 400 · 20018
{
  "request_id": "req_example",
  "error": {
    "code": "unsupported_provider_auth_mode",
    "numeric_code": "20018",
    "message": "Auth mode not supported by this provider"
  }
}
wallet_invalid_request · 20021 · 400

Check the wallet account request and any optional Idempotency-Key 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 · 20021
{
  "request_id": "req_example",
  "error": {
    "code": "wallet_invalid_request",
    "numeric_code": "20021",
    "message": "Invalid wallet account 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.

Illustrative JSON; message varies with the actual cause · 403 · 11002
{
  "request_id": "req_example",
  "error": {
    "code": "workspace_override_forbidden",
    "numeric_code": "11002",
    "message": "Workspace override is not allowed"
  }
}
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_allocation_busy · 20011 · 409

Account allocation is busy; retry after a short delay.

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 · 20011
{
  "request_id": "req_example",
  "error": {
    "code": "account_allocation_busy",
    "numeric_code": "20011",
    "message": "Allocation is busy in the current region; please retry later"
  }
}
duplicate_provider_account · 20015 · 409

This channel identity is already connected to another account in this workspace.

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 · 20015
{
  "request_id": "req_example",
  "error": {
    "code": "duplicate_provider_account",
    "numeric_code": "20015",
    "message": "A provider account with the same identity already exists in this workspace"
  }
}
no_allocatable_server · 20013 · 409

No capacity is available in this region; query regions for an allocatable option.

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 · 20013
{
  "request_id": "req_example",
  "error": {
    "code": "no_allocatable_server",
    "numeric_code": "20013",
    "message": "No allocatable server in the current region"
  }
}
wallet_account_creation_in_progress · 20030 · 409

Another wallet account is being created in this workspace. Wait for it to complete before trying again.

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 · 20030
{
  "request_id": "req_example",
  "error": {
    "code": "wallet_account_creation_in_progress",
    "numeric_code": "20030",
    "message": "Account creation is in progress; please wait"
  }
}
wallet_idempotency_conflict · 20024 · 409

This idempotency key belongs to different business parameters. Reconcile the original operation before starting another.

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 · 20024
{
  "request_id": "req_example",
  "error": {
    "code": "wallet_idempotency_conflict",
    "numeric_code": "20024",
    "message": "Idempotency key was used for a different request"
  }
}
wallet_insufficient_funds · 20023 · 409

The wallet cannot cover this account purchase. The owner can top up, then confirm the original request.

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 · 20023
{
  "request_id": "req_example",
  "error": {
    "code": "wallet_insufficient_funds",
    "numeric_code": "20023",
    "message": "Insufficient wallet balance"
  }
}
wallet_workspace_disabled · 20022 · 409

New wallet purchases are disabled; do not assume existing account operations are cancelled.

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 · 20022
{
  "request_id": "req_example",
  "error": {
    "code": "wallet_workspace_disabled",
    "numeric_code": "20022",
    "message": "New wallet purchases are disabled"
  }
}
workspace_account_quota_exceeded · 20014 · 409

The workspace messaging account limit has been reached; check usage and quota.

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 · 20014
{
  "request_id": "req_example",
  "error": {
    "code": "workspace_account_quota_exceeded",
    "numeric_code": "20014",
    "message": "Workspace account quota exceeded"
  }
}
create_account_failed · 20002 · 500

Create account: resource creation failed or could not be confirmed.

What to do: List or query existing resources to check whether creation already took effect before creating another. Correct the underlying cause and keep request_id; do not create duplicates automatically.

Illustrative JSON; message varies with the actual cause · 500 · 20002
{
  "request_id": "req_example",
  "error": {
    "code": "create_account_failed",
    "numeric_code": "20002",
    "message": "Failed to create account"
  }
}
allocation_service_unavailable · 20012 · 503

Account allocation is temporarily unavailable; retry shortly.

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 · 503 · 20012
{
  "request_id": "req_example",
  "error": {
    "code": "allocation_service_unavailable",
    "numeric_code": "20012",
    "message": "Allocation service is temporarily unavailable"
  }
}
wallet_unavailable · 20028 · 503

Wallet data or configuration is temporarily unavailable. A failed write can have an unknown result; reconcile the original operation.

What to do: Read the current resource state and confirm the previous outcome before repeating this change. Keep request_id; do not automatically repeat a write whose outcome is unknown.

Illustrative JSON; message varies with the actual cause · 503 · 20028
{
  "request_id": "req_example",
  "error": {
    "code": "wallet_unavailable",
    "numeric_code": "20028",
    "message": "Wallet service is unavailable"
  }
}