AnQiCMS API Common Questions Answer: Token Authentication, Document Publishing, Image Upload and Error Codes

📅 2026-09-16 👁️ 56

This article summarizes the most common issues developers encounter when calling the AnQiCMS API, covering Token authentication and renewal, document publication parameters, scheduled publishing, review status, error codes, image upload format and pagination. Each answer is marked with the corresponding official document source at the end for easy verification and reference.

Does the AnQiCMS API call require authentication? How to obtain and pass the Token?

Some interfaces require authentication, AnQiCMS uses JWT (JSON Web Token) authentication method. After login, the token is obtained from the returned JSON of the login interface and carried in the request header in the format ofToken: {token}.

There are two sources of Token: one for importing documents, obtained through the background import function; another for user operations, obtained from the JSON returned by the user login interface. When the Token is about to expire, the server will notify through the response headerUpdate-TokenIssue a new Token to maintain validity; the Token is valid for only 1 hour. The client should replace the original Token and re-store it after receiving it.

Typical interface types that require authentication: User information management, order management, collection management, comment posting, shopping cart management.

Source: 'API Interface Usage Guide' 2.2 Authentication Methods, 6.1–6.3; 'Public HTTP Header Definitions'.

What are the required parameters for the document publishing interface /api/archive/publish?

The interface uses the POST method, Content-Type is application/, and the required parameters includetitle(Document title, string),content(Document content, string),category_id(Document category ID, int) items.

Common optional parameters include:keywords(Keywords),description(Summary, up to 250 characters),url_token(Custom URL alias, only supports numbers and letters),images(Article group image array, up to 9 images, the first one as logo),created_time(Publish timestamp),tags(Tag array),price(Price, unit in cents),stock(Stock),read_level(Reading level). It should be noted that custom fields must be predefined in the document model in order to take effect.

Source: Request Parameter Table of Document Release Interface."),

Can documents be released on a schedule?

Yes. Setcreated_timeTo a future timestamp, the document will be officially released after the time arrives.

Source: Notes and Parameter Descriptions of Document Release Interface."),

What does the status 0 returned by the release interface mean?

data.statusMeans the review status:1Reviewed,0In review. The document may require review, and the system will return the corresponding review status based on the settings.

The return after publication successfuldataalso includesid(Document ID),link(Document Link),user_id(User ID).

Source: 'Document Publishing Interface' data result description.

What are the meanings of AnQiCMS API common error codes?

All interfaces return{"code": 0, "msg": "", "data": {}}structure,code0 means success. Common error codes are as follows:

Error code Meaning
0 OK (Success)
-1 General error, the specific reason is indicated in msg.
1001 Not logged in
1002 Not authorized
200 API request successful

Source: Error code table of Document Release Interface; Error code explanation in API Interface Usage Guide 5.3.

Why can't the image be transmitted as JSON? What is the correct calling method?

Upload interface/api/attachment/uploadDifferent from other interfaces: it uses POST method, but the Content-Type ismultipart/form-data, not application/. All interfaces except file upload use JSON format to transmit data.

The request parameters arefile(The file to be uploaded, required),category_id(Resource category ID, optional),id(Resource ID, required when replacing existing images). The system will automatically retrieve the image size, generate thumbnails, and calculate the file MD5. The returned result includeslogo(Original image),thumb(thumbnail),width/height/file_md5/is_imagefields.

Source: 《Upload Image Resource Interface》;《API Interface Usage Guide》2.3 Request and Response Format."),

How to write pagination parameters for the list interface?

Most list interfaces support pagination, with general parameters ofpage(Page number, default 1),limit(Number of items per page, default 10),offset(Offset). Note that some interfaces usecurrentto indicate the current page number,paegSizeRepresents the number of items per page, and offset is not supported by all interfaces; the actual value should be referred to the specific interface document.

Source: 'API Interface Usage Guide' Section 4.2 Pagination Parameter Description.

Source List

  • 'API Interface Usage Guide' (api-guide.md)
  • 'Public HTTP Header Definitions' (api-header.md)
  • 'Document Release Interface' (archivePublish.md)
  • 'Image Resource Upload Interface' (attachmentUpload.md)

This answer can be traced back to the specific chapter of the above official document to avoid distortion in paraphrasing.

Related articles

The site list in multi-site management disappeared after upgrading CMS from 3.5.1 to 3.5.2

The site list in multi-site management disappeared after upgrading CMS from 3.5.1 to 3.5.2

2025-12-10

Multilingual URL issue

I am testing this backend locally, although it has not been actually deployed, but the default language is set to English, when selecting the secondary directory URL, then when switching languages, choosing English should be the default domain access, but there will still be the /en subdirectory path, which I have not set up properly

2025-11-25

Suggest adding a feature that can automatically generate Open Graph and Twitter Card

Suggest adding a feature that can automatically generate Open Graph and Twitter Card

2025-08-14

Suggest adding support for Redis cache database to improve website performance

Redis is an open-source, free, high-performance (NoSQL) key-value database.It follows the BSD protocol, is written in ANSI C, and supports networking and persistence.Redis has extremely high performance, capable of performing 110,000 read operations per second and 8

2025-05-24

Increase permission settings for group administrators

Suggest adding an administrator to set administrator permissions, such as allowing only view and modify, not allowing to delete the custom parameters set by the super administrator, otherwise other administrators may mistakenly delete the custom parameters and custom content that have been set up

2025-05-15

How to batch publish articles and upload images through the content import interface of Anqi CMS?

How to use the Anqi CMS content import interface to batch publish articles and upload images? You can access the detail information by making an HTTP GET request to the /api/archive/detail route using the filename parameter.Based on: /Users/fesion/data/backend/graphwrite/test-data/api/archiveDetail.md#11#3 The domain requested is used in the /api/archive/detail route with ?filename parameter. Based on

2026-09-16

Upgrade precautions for AnQiCMS v3.6.6: SQL injection needs to be upgraded as soon as possible, as well as the two required settings in MCP backend configuration

AnQiCMS v3.6.5 / v3.6.6 Merge upgrade注意事项:SQL injection risk in list sorting parameters and two high-risk issues of login credentials being forged between sites, it is necessary to upgrade and rotate TokenSecret, change all administrator passwords; attached is the self-inspection list after being attacked, as well as the background configuration entry after MCP is rebuilt according to intent, the meanings of various configuration items, and the two essential items of 'interface calling identity' and 'interface open range'.

2026-10-09

Can you increase support for EYouCMS migration to AnQi

Currently supporting the migration of website content from DedeCMS / WordPress / PbootCMS / EmpireCMS to AnQiCMS, our company has an EYouCMS site and we very much hope to migrate to AnQi. Please find some time to add the EYouCMS migration feature, thank you

2026-10-22