WeChat Official Accounts Account Historical Articles API (V1)
API health status
Healthy Available Limited Mostly unavailable No data
Loading health status...
Retrieves historical posts for a WeChat Official Account by username, with cursor pagination and article, video, audio, or image content tabs. Use it to browse an account's publishing history.
Request Body
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
token | form | string | Yes | - | Access token for this API service. |
username | form | string | Yes | - | WeChat Official Account username with the gh_ prefix. |
offset | form | string | No | | Base64 pagination cursor. Leave empty for the first page; pass next_offset from the previous response for the next page. Send it in the URL-encoded form body. |
itemShowType | form | string | No | ARTICLE | Content tab. Defaults to ARTICLE. Available Values: - ARTICLE: Articles- VIDEO: Videos- AUDIO: Audio- IMAGE: Images |
Code Samples
bash
curl --max-time 120 -X POST 'https://api.justoneapi.com/api/weixin/get-account-history-articles/v1' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'token=YOUR_API_KEY&username=string&offset=&itemShowType=ARTICLE'text
I want to use the "Account Historical Articles (V1)" API from JustOneAPI.
Base URL: https://api.justoneapi.com.
API Path: /api/weixin/get-account-history-articles/v1
API Endpoint: BASE_URL + /api/weixin/get-account-history-articles/v1
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-v1-en.json
Request headers:
- Content-Type: application/x-www-form-urlencoded
Request Body (Form):
- token (form): Access token for this API service. (Required)
- username (form): WeChat Official Account username with the gh_ prefix. (Required)
- offset (form): Base64 pagination cursor. Leave empty for the first page; pass next_offset from the previous response for the next page. Send it in the URL-encoded form body.
- itemShowType (form): Content tab. Defaults to ARTICLE.
Available Values:
- `ARTICLE`: Articles
- `VIDEO`: Videos
- `AUDIO`: Audio
- `IMAGE`: Images
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
import requests
BASE_URL = "https://api.justoneapi.com" # Provided by OpenAPI servers
url = BASE_URL + "/api/weixin/get-account-history-articles/v1"
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
data = "token=YOUR_API_KEY&username=string&offset=&itemShowType=ARTICLE"
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
const BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
const url = BASE_URL + "/api/weixin/get-account-history-articles/v1";
const response = await fetch(url, {
method: "POST",
headers: Object.fromEntries([
["Content-Type", "application/x-www-form-urlencoded"],
]),
body: "token=YOUR_API_KEY&username=string&offset=&itemShowType=ARTICLE",
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
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/v1";
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&username=string&offset=&itemShowType=ARTICLE"));
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
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/v1"
var data = strings.NewReader("token=YOUR_API_KEY&username=string&offset=&itemShowType=ARTICLE")
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
$BASE_URL = 'https://api.justoneapi.com'; // Provided by OpenAPI servers
$url = $BASE_URL . '/api/weixin/get-account-history-articles/v1';
$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&username=string&offset=&itemShowType=ARTICLE');
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;
}Response Fields
Key fields in a successful response (code = 0).
Page and continuation6 fields
data
WeChat Official Account history records and continuation information for the selected content tab.
| Field | Type | Description |
|---|---|---|
biz_username | string | Official Account username returned for the history page, with the gh_ prefix. |
count | integer | Number of history records returned in this response. |
pages | integer | Platform page count returned with this response. |
is_end | integer | null | Reported end-of-list flag. Checked pages returned 0 with a cursor and 1 at the end. Empty results can return null. |
next_offset | string | null | Continuation value for the next page. Pass a nonempty value unchanged as the offset form field. It can be null. |
articles | array | History records for the selected content tab. An empty list can be returned. |
Message groups10 fields
data.articles[]
| Field | Type | Description |
|---|---|---|
baseInfo | object | Platform message information accompanying a history record. |
baseInfo.msgId | integer | Message ID returned in the history record. It can be zero for a video record. |
baseInfo.msgType | integer | Platform message type code for the history record. |
baseInfo.dateTime | integer | Message timestamp in Unix seconds. It can be zero for a video record. |
appMsg | object | Message group and its individual content items. |
appMsg.baseInfo | object | Basic information for the grouped message. |
appMsg.baseInfo.appMsgId | integer | WeChat message ID returned for the grouped content. |
appMsg.baseInfo.type | integer | Platform type code for the grouped message. |
appMsg.baseInfo.createTime | integer | Creation time of the grouped message in Unix seconds. |
appMsg.baseInfo.updateTime | integer | Update time of the grouped message in Unix seconds. |
Content items14 fields
data.articles[].appMsg.detailInfo[]
Individual content items in the message group.
| Field | Type | Description |
|---|---|---|
title | string | Title displayed for the content item. |
showDesc | string | Description text returned for display with the content item. |
shortShowDesc | string | Short display description of the content item, when provided. |
digest | string | Digest returned for the content item. It can be empty. |
authorDesc | string | Author description text returned for the content item. It can be empty. |
contentUrl | string | Content link returned for the item. |
sourceUrl | string | Source link returned with this item, when available. |
sendTime | integer | Send time for the content item in Unix seconds, when provided. |
itemIndex | integer | Position reported for the content item within its message group. |
itemShowType | integer | Platform display-type code returned for this content item. |
isModified | integer | Modification indicator reported for the content item. |
isPaid | integer | Paid-content indicator reported for the content item. |
isPaySubscribe | integer | Paid-subscription indicator reported for the content item. |
picCount | integer | Picture count reported for the content item. |
Covers and video12 fields
data.articles[].appMsg.detailInfo[]
| Field | Type | Description |
|---|---|---|
coverImgUrl | string | Primary cover image URL returned for this item. |
coverImgUrl11 | string | Cover image URL returned for variant 11. |
coverImgUrl169 | string | Cover image URL returned for variant 169. |
coverImgUrl169640 | string | Cover image URL returned for variant 169640. |
coverImgUrl2351 | string | Cover image URL returned for variant 2351. |
coverimgurl34 | string | Cover image URL returned for variant 34. |
preloadPictureInfo | object | null | Image supplied for preloading when available. It can be null. |
preloadPictureInfo.cdnUrl | string | URL of the image supplied for preloading. |
videoId | string | Video identifier returned for this content item. It can be empty. |
videoDuration | integer | Reported video duration value. Its time unit is unconfirmed. |
videoWidth | integer | Video frame width reported for the item. It can be zero. |
videoHeight | integer | Video frame height reported for the item. It can be zero. |
Engagement counts2 fields
data.articles[].appMsg.detailInfo[].statInfo
Engagement counters returned for the content item when provided.
| Field | Type | Description |
|---|---|---|
likeNum | integer | Reported number of likes for the content item. |
readNum | integer | Reported read count for the content item. |
Response Example
Loading the response example...