Skip to content

API Reference

iClick provides a WebSocket-based interface that listens on local port 23188 by default.

Connection Information

Connection Address: ws://127.0.0.1:23188

Communication Protocol

Request Format

Client sends JSON format requests:

json
{
  "type": "api_method_name",
  "evtid": "unique_event_id",
  "timeout": 18,
  "param1": "value1",
}

Field Description:

  • type (string): API method name
  • evtid (string): Unique event ID for matching requests and responses
  • timeout (number): Timeout in seconds, optional, supported by some interfaces
  • Other parameters depend on the specific API method

Response Format

Server returns two formats:

1. JSON Format Response (Regular Data):

json
{
  "evtid": "unique_event_id",
  "type": "success",
  "data": /*return result*/
}

2. Binary Format Response (Contains Binary Data):

Binary data format: [6-byte metadata length][metadata JSON][binary data]

  • First 6 bytes: UTF-8 encoded metadata length string
  • Metadata: JSON format response information
  • Binary data: Actual binary content

Error Response

json
{
  "evtid": "unique_event_id",
  "type": "error",
  "error": "error message"
}

Server Event Push

Events actively pushed by the server:

json
{
  "type": "event",
  "event": "event_name",
  "data": { "payload": "..." }
}

📢 Event Notifications

See Event Notifications for all available event types and detailed descriptions

Client Implementation

We provide WebSocket client implementation examples for multiple programming languages to help you quickly integrate with iClick API:

📚 Multi-language Support

See Multi-language Client Implementation for complete client code examples

Cooperation: try.catch@foxmail.com