# 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="/files/MvHDZBTgHvGn7I515LsX" 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="/pages/S1qUrjmiVyUWQ8ZqTHbS"><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**](/en-docs/websocket/subscription-address.md) — defines how to construct subscription URLs and parameters.
* [**WebSocket Example Code**](/en-docs/websocket/websocket-code-example.md) — provides sample code for establishing and maintaining a live connection.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.infoway.io/en-docs/getting-started/http-protocols.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
