# HTTP Protocols

### 1.1 Request Protocol

All HTTP endpoints use the `GET` method. You must include your **API Key** in the request headers for authentication.

<figure><img src="https://1901211983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrTkunUCwdeoQFhVPLOYt%2Fuploads%2FCzrJt4MCUntYIu8offhO%2Fapi-request-header.png?alt=media&#x26;token=4e06af92-a969-450d-8227-13c09f816381" alt=""><figcaption></figcaption></figure>

### 1.2 Response Format

All responses are returned in **JSON** format.

#### **Example Response**

```json
{
    "ret": 200,
    "msg": "success",
    "traceId": "698f920a-c53b-401c-bfac-4ea46b9b8f12",
    "data": [
        
    ]
}
```

#### Response Fields

<table><thead><tr><th width="99.7777099609375">Field</th><th>Description</th></tr></thead><tbody><tr><td><code>ret</code></td><td>Response code. <code>200</code> indicates a successful response. Other values correspond to specific error codes (see <a href="error-codes"><em>Error Codes</em> section</a>).</td></tr><tr><td><code>msg</code></td><td>A brief message describing the request status, e.g., <code>"success"</code>.</td></tr><tr><td><code>traceId</code></td><td>A unique identifier automatically generated by the system for each request. Useful for debugging and tracing requests in logs.</td></tr><tr><td><code>data</code></td><td>The actual data payload returned by the API. The structure depends on the specific endpoint called.</td></tr></tbody></table>

### 2. WebSocket Protocol Overview

All WebSocket connections share the **same base URL**.\
Different data types (stocks, crypto, forex, etc.) are distinguished by **subscription parameters** rather than separate endpoints.

Please refer to the following sections for details:

* [**WebSocket Subscription Address Specification**](https://docs.infoway.io/en-docs/websocket/subscription-address) — defines how to construct subscription URLs and parameters.
* [**WebSocket Example Code**](https://docs.infoway.io/en-docs/websocket/websocket-code-example) — provides sample code for establishing and maintaining a live connection.
