---
title: "WeChat Official Accounts Account Historical Articles API (V2)"
description: "Retrieves historical articles for a WeChat Official Account identified by ghid or article URL, with an offset cursor from the previous page. Use it to continue through an account's article archive with cursor pagination."
aiUsagePrompt: true
---

# WeChat Official Accounts Account Historical Articles API \(V2\)

<ApiTester
  method="POST"
  :path='JSON.parse("\"/api/weixin/get-account-history-articles/v2\"")'
  :summary='JSON.parse("\"Account Historical Articles (V2)\"")'
  openapiDefinitionUrl="https://docs.justoneapi.com/openapi/wechat-official-accounts/account-historical-articles-v2-en.json"
  openapiVersion="3.1.0"
  :parameters='JSON.parse("[]")'
  :requestBody='JSON.parse("{\"content\":{\"application/x-www-form-urlencoded\":{\"schema\":{\"type\":\"object\",\"properties\":{\"token\":{\"type\":\"string\",\"description\":\"Access token for this API service.\"},\"ghid\":{\"type\":\"string\",\"default\":\"\",\"description\":\"WeChat Official Account original identifier, using the gh_ prefix returned by WeChat. Use either ghid or url.\"},\"url\":{\"type\":\"string\",\"default\":\"\",\"description\":\"WeChat Official Account article URL used to identify the account and fetch historical articles. Use either ghid or url.\"},\"offset\":{\"type\":\"string\",\"default\":\"\",\"description\":\"PagingInfo.Offset cursor returned by the previous response. Leave it empty for the first page. For this POST endpoint, send it in an application/x-www-form-urlencoded form body.\"}},\"required\":[\"token\"]}}},\"required\":true}")'
  :responses='JSON.parse("{\"200\":{\"description\":\"OK\",\"content\":{\"application/json\":{\"schema\":{\"if\":{\"properties\":{\"code\":{\"const\":0}},\"required\":[\"code\"]},\"then\":{\"properties\":{\"data\":{\"type\":\"object\",\"description\":\"Historical article messages and pagination for the requested WeChat Official Account.\",\"properties\":{\"AccountInfo\":{\"type\":\"object\",\"description\":\"Public profile of the WeChat Official Account.\",\"properties\":{\"UserName\":{\"type\":\"string\",\"description\":\"Original WeChat Official Account identifier with the gh_ prefix.\"},\"NickName\":{\"type\":\"string\",\"description\":\"Display name of the WeChat Official Account.\"},\"HeadImgUrl\":{\"type\":\"string\",\"description\":\"Profile image URL for the WeChat Official Account.\"},\"ServiceType\":{\"type\":\"integer\",\"description\":\"Numeric account type code reported for this profile.\"}}},\"HasArtile\":{\"type\":\"boolean\",\"description\":\"Whether the account has articles, as reported by the API.\"},\"IPWording\":{\"type\":\"string\",\"description\":\"IP location label displayed for the account.\"},\"MsgList\":{\"type\":\"object\",\"description\":\"Historical messages and related information returned for this page.\",\"properties\":{\"Msg\":{\"type\":\"array\",\"description\":\"Message groups returned on this page. Each article message can contain more than one article.\",\"items\":{\"type\":\"object\",\"description\":\"One historical message group.\",\"properties\":{\"BaseInfo\":{\"type\":\"object\",\"description\":\"Metadata for this message group.\",\"properties\":{\"MsgId\":{\"type\":\"integer\",\"description\":\"Identifier of the historical message group.\"},\"DateTime\":{\"type\":\"integer\",\"description\":\"Timestamp reported for the message group, in Unix seconds.\"},\"MsgType\":{\"type\":\"integer\",\"description\":\"Numeric message type code reported for the message group.\"},\"UniqueId\":{\"type\":\"string\",\"description\":\"Text identifier reported for this message group.\"}}},\"AppMsg\":{\"type\":\"object\",\"description\":\"Article message containing its metadata and individual articles.\",\"properties\":{\"BaseInfo\":{\"type\":\"object\",\"description\":\"Metadata for the article message.\",\"properties\":{\"AppMsgId\":{\"type\":\"integer\",\"description\":\"Article message identifier, matching the mid parameter in its article URLs.\"},\"Type\":{\"type\":\"integer\",\"description\":\"Numeric type code reported for the article message.\"},\"CreateTime\":{\"type\":\"integer\",\"description\":\"Creation timestamp reported for the article message, in Unix seconds.\"},\"UpdateTime\":{\"type\":\"integer\",\"description\":\"Update timestamp reported for the article message, in Unix seconds.\"}}},\"DetailInfo\":{\"type\":\"array\",\"description\":\"Individual articles grouped under this article message.\",\"items\":{\"type\":\"object\",\"description\":\"One article in the article message.\",\"properties\":{\"ItemIndex\":{\"type\":\"integer\",\"description\":\"Position of this article within the message, matching the article URL&#39;s idx parameter.\"},\"Title\":{\"type\":\"string\",\"description\":\"Article title.\"},\"Digest\":{\"type\":\"string\",\"description\":\"Article summary, which may be empty.\"},\"ShortShowDesc\":{\"type\":\"string\",\"description\":\"Short description displayed for the article, which may be empty.\"},\"ContentUrl\":{\"type\":\"string\",\"description\":\"WeChat article URL.\"},\"SourceUrl\":{\"type\":\"string\",\"description\":\"Source link reported for the article, which may be empty.\"},\"PublishTime\":{\"type\":\"string\",\"description\":\"Article publication time as text in YYYY-MM-DD HH:mm:ss format (UTC+8), when provided.\"},\"send_time\":{\"type\":\"integer\",\"description\":\"Article publication time as a Unix timestamp in seconds.\"},\"IsOriginal\":{\"type\":\"integer\",\"description\":\"Numeric originality indicator reported for the article.\"},\"Read\":{\"type\":\"integer\",\"description\":\"Read count value reported for the article.\"},\"Zan\":{\"type\":\"integer\",\"description\":\"Like count reported in the article entry.\"},\"stat_info\":{\"type\":\"object\",\"description\":\"Optional article statistics.\",\"properties\":{\"like_num\":{\"type\":\"integer\",\"description\":\"Like count reported in the statistics object. It can differ from Zan.\"}}},\"CoverImgUrl\":{\"type\":\"string\",\"description\":\"Main cover image URL.\"},\"CoverImgUrl_16_9\":{\"type\":\"string\",\"description\":\"Cover image URL for the 16:9 variant.\"},\"CoverImgUrl_16_9_640\":{\"type\":\"string\",\"description\":\"Cover image URL for the 16:9 variant identified as 640.\"},\"CoverImgUrl_1_1\":{\"type\":\"string\",\"description\":\"Cover image URL for the square variant.\"},\"CoverImgUrl_235_1\":{\"type\":\"string\",\"description\":\"Cover image URL for the 2.35:1 variant.\"},\"coverimgurl_3_4\":{\"type\":\"string\",\"description\":\"Cover image URL for the 3:4 variant.\"},\"SuggestedCoverImg\":{\"type\":\"object\",\"description\":\"Suggested article cover and its size hints.\",\"properties\":{\"url\":{\"type\":\"string\",\"description\":\"Suggested cover image URL.\"},\"width_hint\":{\"type\":\"integer\",\"description\":\"Width hint for the suggested cover.\"},\"height_hint\":{\"type\":\"integer\",\"description\":\"Height hint for the suggested cover.\"}}},\"preload_picture_info\":{\"type\":\"object\",\"description\":\"Picture information reported for preloading.\",\"properties\":{\"cdn_url\":{\"type\":\"string\",\"description\":\"CDN URL for the preload picture.\"}}},\"comment_topic_id\":{\"type\":\"integer\",\"description\":\"Comment topic identifier reported for the article.\"}}}}}}}}},\"FeaturedList\":{\"type\":\"array\",\"description\":\"Featured list returned with the message page. It may be empty.\"},\"FeaturedUpdateTime\":{\"type\":\"integer\",\"description\":\"Update timestamp reported for the featured list, in Unix seconds.\"},\"PagingInfo\":{\"type\":\"object\",\"description\":\"Pagination information inside the message list.\",\"properties\":{\"Offset\":{\"type\":\"string\",\"description\":\"Cursor text reported inside the message list.\"},\"IsEnd\":{\"type\":\"integer\",\"description\":\"End-of-list flag reported inside the message list.\"}}}}},\"PagingInfo\":{\"type\":\"object\",\"description\":\"Pagination information for the response. Use this object&#39;s Offset for the next request.\",\"properties\":{\"Offset\":{\"type\":\"string\",\"description\":\"Opaque cursor for the next page. Pass it unchanged as the offset form value when continuing.\"},\"IsEnd\":{\"type\":\"integer\",\"description\":\"Numeric end-of-history flag. Pages that can continue return 0.\"}}},\"TopicList\":{\"type\":\"array\",\"description\":\"Topic list returned with the response. It may be empty.\"},\"BanReason\":{\"type\":\"array\",\"description\":\"Account restriction reasons when provided. The array may be empty.\"},\"VideoFinderInfo\":{\"type\":\"object\",\"description\":\"WeChat Channels information when provided. The object may be empty.\"}}}}},\"allOf\":[{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}]}}}},\"400\":{\"description\":\"Invalid request parameters or body\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"401\":{\"description\":\"Invalid or inactive access token\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"403\":{\"description\":\"Permission denied\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"429\":{\"description\":\"Request rate or daily quota limit exceeded\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"500\":{\"description\":\"Internal server error\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"503\":{\"description\":\"Service temporarily unavailable\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}}}")'
  :servers='JSON.parse("[{\"url\":\"https://api.justoneapi.com\",\"description\":\"Global production API (default)\"}]")'
  :security='JSON.parse("[]")'
  :securitySchemes='JSON.parse("{}")'
  :schemas='JSON.parse("{}")'
/>

<ApiHealthSection :api='JSON.parse("\"/api/weixin/get-account-history-articles/v2\"")' />

<p>Retrieves historical articles for a WeChat Official Account identified by ghid or article URL, with an offset cursor from the previous page. Use it to continue through an account's article archive with cursor pagination.</p>

## Request Body

<div class="api-doc-table api-doc-table--params">

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| <code>token</code> | form | <code>string</code> | Yes | - | Access token for this API service. |
| <code>ghid</code> | form | <code>string</code> | No | <code></code> | WeChat Official Account original identifier, using the gh_ prefix returned by WeChat. Use either ghid or url. |
| <code>url</code> | form | <code>string</code> | No | <code></code> | WeChat Official Account article URL used to identify the account and fetch historical articles. Use either ghid or url. |
| <code>offset</code> | form | <code>string</code> | No | <code></code> | PagingInfo.Offset cursor returned by the previous response. Leave it empty for the first page. For this POST endpoint, send it in an application/x-www-form-urlencoded form body. |

</div>

## Code Samples

::: code-group

```bash [🐚 cURL]
curl --max-time 120 -X POST 'https://api.justoneapi.com/api/weixin/get-account-history-articles/v2' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'token=YOUR_API_KEY&ghid=&url=&offset='
```

```text [🤖 AI Prompt]
I want to use the "Account Historical Articles (V2)" API from JustOneAPI.
Base URL: https://api.justoneapi.com.
API Path: /api/weixin/get-account-history-articles/v2
API Endpoint: BASE_URL + /api/weixin/get-account-history-articles/v2
HTTP Method: POST
Authentication: Send "token" as an application/x-www-form-urlencoded body field.
OpenAPI Definition: https://docs.justoneapi.com/openapi/wechat-official-accounts/account-historical-articles-v2-en.json
Request headers:
- Content-Type: application/x-www-form-urlencoded

Request Body (Form):
- token (form): Access token for this API service. (Required)
- ghid (form): WeChat Official Account original identifier, using the gh_ prefix returned by WeChat. Use either ghid or url.
- url (form): WeChat Official Account article URL used to identify the account and fetch historical articles. Use either ghid or url.
- offset (form): PagingInfo.Offset cursor returned by the previous response. Leave it empty for the first page. For this POST endpoint, send it in an application/x-www-form-urlencoded form body.

Return format: safely handle JSON or text according to the actual Content-Type.

Response Handling & Error Codes:
1. Business results should be determined by the "code" field in the response body (code 0 means success).
2. Timeout Recommendation: Set the request timeout to 120 seconds. If 120 seconds is too long for your use case, use at least 60 seconds, but a small number of requests may time out before receiving a result.
3. Business Code Reference:
   - 0: Success
   - 100: Invalid or Inactive Token
   - 301: Collection Failed. Please Retry.
   - 302: Rate Limit Exceeded
   - 303: Daily Quota Exceeded
   - 400: Invalid Parameters
   - 500: Internal Server Error
   - 600: Permission Denied
   - 601: Insufficient Balance
   - 602: Token Budget Exceeded
4. Code 601 means the shared account balance is insufficient. Code 602 means the current API token's own cumulative budget limit has been reached. Token budget limits do not transfer funds out of the shared account balance.

Please help me write a script in my preferred programming language to call this API and handle the response.
```

```python [🐍 Python]
import requests

BASE_URL = "https://api.justoneapi.com"  # Provided by OpenAPI servers

url = BASE_URL + "/api/weixin/get-account-history-articles/v2"
headers = {
    "Content-Type": "application/x-www-form-urlencoded"
}
data = "token=YOUR_API_KEY&ghid=&url=&offset="
response = requests.post(url, headers=headers, data=data, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
```

```js [🌐 JavaScript]
const BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
const url = BASE_URL + "/api/weixin/get-account-history-articles/v2";

const response = await fetch(url, {
  method: "POST",
  headers: Object.fromEntries([
    ["Content-Type", "application/x-www-form-urlencoded"],
  ]),
  body: "token=YOUR_API_KEY&ghid=&url=&offset=",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
```

```java [☕ Java]
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
        final String url = BASE_URL + "/api/weixin/get-account-history-articles/v2";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .header("Content-Type", "application/x-www-form-urlencoded")
            .method("POST", HttpRequest.BodyPublishers.ofString("token=YOUR_API_KEY&ghid=&url=&offset="));

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
```

```go [🐹 Go]
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // Provided by OpenAPI servers

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/weixin/get-account-history-articles/v2"
	var data = strings.NewReader("token=YOUR_API_KEY&ghid=&url=&offset=")
	req, _ := http.NewRequest("POST", url, data)
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
```

```php [🐘 PHP]
<?php
$BASE_URL = 'https://api.justoneapi.com'; // Provided by OpenAPI servers
$url = $BASE_URL . '/api/weixin/get-account-history-articles/v2';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, 'token=YOUR_API_KEY&ghid=&url=&offset=');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/x-www-form-urlencoded',
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}
```

:::

<div style="text-align: right; margin-top: -20px; margin-bottom: 20px;">
<a href="/openapi/wechat-official-accounts/account-historical-articles-v2-en.json" target="_blank" style="font-size: 12px; color: var(--vp-c-text-3); text-decoration: none; opacity: 0.8;">[OpenAPI Definition (JSON)]</a>
</div>

## Response Fields

Key fields in a successful response (`code = 0`).

<div class="api-doc-table api-doc-table--response">

| Field path | Type | Description |
| --- | --- | --- |
| <code>data</code> | <code>object</code> | Historical article messages and pagination for the requested WeChat Official Account. |
| <code>data.AccountInfo</code> | <code>object</code> | Public profile of the WeChat Official Account. |
| <code>data.AccountInfo.UserName</code> | <code>string</code> | Original WeChat Official Account identifier with the gh_ prefix. |
| <code>data.AccountInfo.NickName</code> | <code>string</code> | Display name of the WeChat Official Account. |
| <code>data.AccountInfo.HeadImgUrl</code> | <code>string</code> | Profile image URL for the WeChat Official Account. |
| <code>data.AccountInfo.ServiceType</code> | <code>integer</code> | Numeric account type code reported for this profile. |
| <code>data.HasArtile</code> | <code>boolean</code> | Whether the account has articles, as reported by the API. |
| <code>data.IPWording</code> | <code>string</code> | IP location label displayed for the account. |
| <code>data.MsgList</code> | <code>object</code> | Historical messages and related information returned for this page. |
| <code>data.MsgList.Msg</code> | <code>array</code> | Message groups returned on this page. Each article message can contain more than one article. |
| <code>data.MsgList.Msg[]</code> | <code>object</code> | One historical message group. |
| <code>data.MsgList.Msg[].BaseInfo</code> | <code>object</code> | Metadata for this message group. |
| <code>data.MsgList.Msg[].BaseInfo.MsgId</code> | <code>integer</code> | Identifier of the historical message group. |
| <code>data.MsgList.Msg[].BaseInfo.DateTime</code> | <code>integer</code> | Timestamp reported for the message group, in Unix seconds. |
| <code>data.MsgList.Msg[].BaseInfo.MsgType</code> | <code>integer</code> | Numeric message type code reported for the message group. |
| <code>data.MsgList.Msg[].BaseInfo.UniqueId</code> | <code>string</code> | Text identifier reported for this message group. |
| <code>data.MsgList.Msg[].AppMsg</code> | <code>object</code> | Article message containing its metadata and individual articles. |
| <code>data.MsgList.Msg[].AppMsg.BaseInfo</code> | <code>object</code> | Metadata for the article message. |
| <code>data.MsgList.Msg[].AppMsg.BaseInfo.AppMsgId</code> | <code>integer</code> | Article message identifier, matching the mid parameter in its article URLs. |
| <code>data.MsgList.Msg[].AppMsg.BaseInfo.Type</code> | <code>integer</code> | Numeric type code reported for the article message. |
| <code>data.MsgList.Msg[].AppMsg.BaseInfo.CreateTime</code> | <code>integer</code> | Creation timestamp reported for the article message, in Unix seconds. |
| <code>data.MsgList.Msg[].AppMsg.BaseInfo.UpdateTime</code> | <code>integer</code> | Update timestamp reported for the article message, in Unix seconds. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo</code> | <code>array</code> | Individual articles grouped under this article message. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[]</code> | <code>object</code> | One article in the article message. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].ItemIndex</code> | <code>integer</code> | Position of this article within the message, matching the article URL's idx parameter. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].Title</code> | <code>string</code> | Article title. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].Digest</code> | <code>string</code> | Article summary, which may be empty. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].ShortShowDesc</code> | <code>string</code> | Short description displayed for the article, which may be empty. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].ContentUrl</code> | <code>string</code> | WeChat article URL. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].SourceUrl</code> | <code>string</code> | Source link reported for the article, which may be empty. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].PublishTime</code> | <code>string</code> | Article publication time as text in YYYY-MM-DD HH:mm:ss format (UTC+8), when provided. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].send_time</code> | <code>integer</code> | Article publication time as a Unix timestamp in seconds. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].IsOriginal</code> | <code>integer</code> | Numeric originality indicator reported for the article. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].Read</code> | <code>integer</code> | Read count value reported for the article. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].Zan</code> | <code>integer</code> | Like count reported in the article entry. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].stat_info</code> | <code>object</code> | Optional article statistics. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].stat_info.like_num</code> | <code>integer</code> | Like count reported in the statistics object. It can differ from Zan. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].CoverImgUrl</code> | <code>string</code> | Main cover image URL. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].CoverImgUrl_16_9</code> | <code>string</code> | Cover image URL for the 16:9 variant. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].CoverImgUrl_16_9_640</code> | <code>string</code> | Cover image URL for the 16:9 variant identified as 640. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].CoverImgUrl_1_1</code> | <code>string</code> | Cover image URL for the square variant. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].CoverImgUrl_235_1</code> | <code>string</code> | Cover image URL for the 2.35:1 variant. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].coverimgurl_3_4</code> | <code>string</code> | Cover image URL for the 3:4 variant. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].SuggestedCoverImg</code> | <code>object</code> | Suggested article cover and its size hints. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].SuggestedCoverImg.url</code> | <code>string</code> | Suggested cover image URL. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].SuggestedCoverImg.width_hint</code> | <code>integer</code> | Width hint for the suggested cover. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].SuggestedCoverImg.height_hint</code> | <code>integer</code> | Height hint for the suggested cover. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].preload_picture_info</code> | <code>object</code> | Picture information reported for preloading. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].preload_picture_info.cdn_url</code> | <code>string</code> | CDN URL for the preload picture. |
| <code>data.MsgList.Msg[].AppMsg.DetailInfo[].comment_topic_id</code> | <code>integer</code> | Comment topic identifier reported for the article. |
| <code>data.MsgList.FeaturedList</code> | <code>array</code> | Featured list returned with the message page. It may be empty. |
| <code>data.MsgList.FeaturedUpdateTime</code> | <code>integer</code> | Update timestamp reported for the featured list, in Unix seconds. |
| <code>data.MsgList.PagingInfo</code> | <code>object</code> | Pagination information inside the message list. |
| <code>data.MsgList.PagingInfo.Offset</code> | <code>string</code> | Cursor text reported inside the message list. |
| <code>data.MsgList.PagingInfo.IsEnd</code> | <code>integer</code> | End-of-list flag reported inside the message list. |
| <code>data.PagingInfo</code> | <code>object</code> | Pagination information for the response. Use this object's Offset for the next request. |
| <code>data.PagingInfo.Offset</code> | <code>string</code> | Opaque cursor for the next page. Pass it unchanged as the offset form value when continuing. |
| <code>data.PagingInfo.IsEnd</code> | <code>integer</code> | Numeric end-of-history flag. Pages that can continue return 0. |
| <code>data.TopicList</code> | <code>array</code> | Topic list returned with the response. It may be empty. |
| <code>data.BanReason</code> | <code>array</code> | Account restriction reasons when provided. The array may be empty. |
| <code>data.VideoFinderInfo</code> | <code>object</code> | WeChat Channels information when provided. The object may be empty. |

</div>

## Response Example

<ApiExampleSection :api='JSON.parse("\"/api/weixin/get-account-history-articles/v2\"")' />

