API overview: authentication, requests and responses
Conventions shared by every open API endpoint: base URL, access tokens, request and response format, common error codes, data types, retries, and rate limits.
| Method | URL | Called by | Authentication |
|---|---|---|---|
POST | https://open.acrossflow.com/v1/mp/issue | Old mini program's backend | Issue token |
POST | https://open.acrossflow.com/v1/mp/jump | Old mini program's relay page | wx.login code |
POST | https://open.acrossflow.com/v1/mp/redeem | New mini program's backend | Redeem token |
POST | https://open.acrossflow.com/v1/mp/lookup | New mini program's backend | Redeem token |
POST | https://open.acrossflow.com/v1/mp/migrated | New mini program's backend | Redeem token |
This document defines the conventions shared by every AcrossFlow open API endpoint: authentication, request and response format, common error codes, data types, retry semantics, and rate limits. Endpoint-specific parameters, response fields, and error codes are documented on each endpoint's page.
Basics
- Base URL:
https://open.acrossflow.com. HTTPS only. - The version is part of the path (
/v1). Changes within a version are backward compatible, such as new response fields; clients must ignore fields they do not recognize. - Every endpoint is
POST. Request and response bodies are UTF-8 JSON. - Except for
/v1/mp/jump, the open API is server-to-server only. Access tokens must never appear in mini program code, web pages, or logs.
Authentication
Every endpoint except /v1/mp/jump uses Bearer token authentication. Send the access token in the request header:
Authorization: Bearer aft_…
/v1/mp/jump is called directly from the mini program's relay page and authenticates with a wx.login code instead of an access token; see Self-developed and WeChat authorization.
The merchant creates access tokens on the channel's Integration tab in the Dashboard. A token is the prefix aft_ followed by 43 Base64URL characters.
- Channel binding: each token belongs to exactly one channel and can only act on that channel's data.
- Scope: each token has exactly one scope. Issue is for
/v1/mp/issueand can only be created on a server-integration channel. Redeem is for/v1/mp/redeem,/v1/mp/lookup, and/v1/mp/migrated. A token with both could read any member's balance, so the two scopes cannot be combined. - Secret: the plaintext is shown once, at creation. AcrossFlow stores only its hash; a lost token must be replaced.
- Expiry: an expiry time is optional at creation; without one, the token does not expire. A channel can have at most 20 active tokens.
- Revocation: takes effect immediately. Revoking an Issue token also voids every jump token it issued that has not been redeemed.
Requests are validated in this order: access token, token scope, request body, endpoint parameters. Validation stops at the first failure with no side effects; a redeem request rejected for scope does not consume the jump token.
Request format
POST /v1/mp/redeem HTTP/1.1
Host: open.acrossflow.com
Authorization: Bearer aft_…
Content-Type: application/json
{ "token": "…" }
- The
Content-Typeheader must beapplication/json. - The body must be a JSON object; arrays and other JSON values are rejected.
- String parameters are trimmed of leading and trailing whitespace before validation. Optional parameters may be omitted,
null, or an empty string.
Response format
Response headers:
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
Every JSON response includes a boolean ok. On success the HTTP status is 200, ok is true, and result fields sit alongside it at the top level:
{ "ok": true, "memberId": "mem_…", "migratedAt": "2026-10-27T08:00:00.000Z" }
On failure the HTTP status is 4xx, ok is false, and error is a machine-readable error code:
{ "ok": false, "error": "access_token" }
Branch on error, not on the HTTP status: one status can map to several error codes.
Common error codes
These error codes apply to every endpoint; access_token and forbidden apply only to endpoints that take an access token. Endpoint-specific codes are listed on each endpoint's page.
| HTTP | error | Description |
|---|---|---|
| 400 | invalid | The body is not a JSON object, or a parameter is malformed. Some malformed parameters return an endpoint-specific code instead, e.g. a malformed af_token or jumpTokenId returns 401 token; see each endpoint's page |
| 401 | access_token | The access token is missing, invalid, expired, or revoked. The response also carries WWW-Authenticate: Bearer realm="acrossflow" |
| 403 | forbidden | The access token's scope does not match the endpoint |
| 404 | not_found | The path does not exist, or the method is not POST |
A 5xx status indicates a transient server failure. Its body is not guaranteed to be JSON; handle it by status code and retry as described under Retries.
Data types
| Type | Format | Notes |
|---|---|---|
| Points, stored value | Integer | The actual value multiplied by 100: 12050 means 120.50. Stored value is in the currency the merchant imported; the API does not return a currency |
| Timestamp | ISO 8601 string | UTC with millisecond precision, e.g. 2026-10-27T08:00:00.000Z |
| Duration | Integer | Seconds, e.g. expiresIn: 600 |
| OpenID | String | 1–128 characters: letters, digits, _, - |
| Mobile number | String | Must include the country or region code and start with + or 00, for example +85291234567. Spaces, -, ., and parentheses in requests are removed. Responses always use E.164 format (+ followed by 5–20 digits). A number that starts with neither + nor 00 may lack a country or region code and returns 400 invalid |
| Email address | String | Up to 254 characters, case-insensitive. Responses always use lowercase |
| Object ID | String | New IDs use a type prefix and a 26-character lowercase ULID, such as chn_… for a channel or jmp_… for a jump token record. Existing IDs with a 32-character hexadecimal suffix still work. Treat IDs as opaque strings. |
| Empty value | null | A field that is present but has no value is null, e.g. member: null for a member who was never imported |
Retries and idempotency
| Endpoint | Idempotent | On timeout or 5xx |
|---|---|---|
/v1/mp/issue | No | Safe to retry. Each call issues a new jump token; unused tokens expire on their own |
/v1/mp/jump | No | A code can be used once. Call wx.login again for a new code before retrying |
/v1/mp/redeem | No | A jump token can be redeemed once. If the server processed the request but the response was lost, a retry returns 401 token; have the member jump again from the old mini program. The same member may then redeem more than once, so deduplicate credits by memberId |
/v1/mp/lookup | Yes | Read-only; retry directly. Every call counts toward the rate limit |
/v1/mp/migrated | Yes | Retry with the same parameters; the first result is returned |
Do not retry 4xx responses unchanged, except 429. Use exponential backoff starting at no less than one second.
Rate limits
| Endpoint | Limit | Scope | When exceeded |
|---|---|---|---|
/v1/mp/issue | 60 per minute | Per Issue token | 429 rate_limited |
/v1/mp/lookup | 60 per minute | Per Redeem token | 429 rate_limited |
Limits are counted separately for each token and endpoint, and are approximate: a short burst may slightly exceed them. Rejected requests also count, so slow down after a 429. Other endpoints are not rate limited.
Privacy compliance
The old mini program's privacy policy must disclose that users' OpenIDs are provided to AcrossFlow to identify members. The new mini program must obtain the user's consent before using migrated points and stored value.