Constants
The values below are stable in v1.6. Any breaking changes will ship via a changelog entry + version bump, with advance notice to integrators.
Base URL
| Environment | URL |
|---|---|
| Production | https://api.coinepay.net |
| Sandbox | None (not provided in v1.5) |
| Local dev | http://localhost:8801 |
API Prefix
/api/v1/openapiHTTP Convention
| Item | Value |
|---|---|
| Method | All POST (project hard rule) |
| Request Content-Type | application/json (multipart/form-data for /cardholder/files/upload only) |
| Response Content-Type | application/json; charset=utf-8 |
| Max body | 4 MB (4194304 bytes) for every endpoint, including /cardholder/files/upload (one file ≤ 2 MB plus multipart overhead). A larger body is rejected as HTTP 401 openapi_invalid_credentials |
| Charset | UTF-8 |
Response Envelope & Codes
| Item | Value |
|---|---|
| Success | {"code": 0, "message": "Success", "data": {...}} |
| Error | {"code": <business code>, "message": "<localized>", "error_key": "<stable key>"} |
error_key | Present on every error response, never on success |
| Success check | code == 0 — not the HTTP status |
| Situation | HTTP | code |
|---|---|---|
| Success (incl. idempotent replay) | 200 | 0 |
| Business / validation rejection | 200 | 40000 |
| Request body cannot be parsed | 200 | 40001 |
| Authentication failure | 401 | 40100 |
| Authenticated but not allowed | 403 | 40300 |
| Card not found / not owned | 404 | 40400 |
| Idempotency-Key conflict / in progress | 409 | 40900 |
| Rate limited | 429 | 42900 |
| Server-side failure handled by the endpoint | 200 | 50000 |
| Unhandled server crash | 500 | 50000 |
See Error Codes for every error_key.
Authentication
| Item | Value |
|---|---|
| Algorithm | HMAC-SHA256 |
| Required headers | X-App-Id / X-Timestamp / X-Nonce / X-Signature |
| AppID format | cp_<28 hex>, fixed length 31 |
| Secret format | 64 hex characters |
| Secret prefix display | <first 4>**** |
| Timestamp unit | Seconds (not milliseconds) |
| Timestamp tolerance | ±300 seconds |
| Nonce length | 8–64 characters |
| Nonce replay window | 600 seconds |
| Signature format | lowercase hex |
| Signature length | 64 characters |
Idempotency
| Item | Value |
|---|---|
| Header | Idempotency-Key |
| Required endpoints | /api/v1/openapi/card/apply / /api/v1/openapi/card/recharge / the cardholder write endpoints /api/v1/openapi/cardholder/files/upload / create / update / delete / submit / kyc/init / kyc/cancel |
| Max length | 128 characters |
| Dedup window | 24 hours |
| Missing / too long / invalid characters | HTTP 200 / 40000 (openapi_idempotency_key_required / openapi_idempotency_key_too_long / openapi_idempotency_key_invalid_chars) |
| Same key, different body | HTTP 409 / 40900 openapi_idempotency_key_conflict |
| Same key + same body while the first request is still running | HTTP 409 / 40900 openapi_idempotency_key_in_progress (does not wait) |
| Responses stored for replay | Any HTTP 2xx response, including business errors (HTTP 200 + 40000 / 50000); non-2xx responses are not stored |
Rate Limit
| Item | Value |
|---|---|
| Dimension | (AppID, IP) |
| Quota | 600 / minute |
| Window | 60 seconds, fixed (starts with the first counted request; not rolling) |
| Exceeded | HTTP 429 / 42900 / too_many_requests, header Retry-After: 60 |
| Gateway limit | The gateway in front of the API may also answer HTTP 429 with the same body (42900 / too_many_requests) |
Webhook Delivery
| Item | Value |
|---|---|
| Signature header | Webhook-Signature |
| Signature format | v1,<hex_hmac_sha256> |
| Signature input | {timestamp}.{raw_body} |
| Event ID header | Webhook-Id |
| Timestamp header | Webhook-Timestamp |
| Type header | Webhook-Type |
| Retry backoff (seconds) | [60, 300, 900, 3600, 21600, 86400] |
| Total delivery attempts | 7 (1 initial + 6 retries; then dead_letter) |
| Receiver response-header timeout | 5 seconds |
| Receiver total request timeout | 10 seconds |
| HTTPS required | ✅ (HTTPS only) |
| Host | Domain name only (no IP addresses in any form); every resolved address must be public |
| Allowed ports | 443 only |
Webhook Event Types
card.opened / card.open_failed / card.recharged / card.recharge_failed / card.closed / card.status_changed — delivered for all card types listed below. cardholder.status_changed (v1.6) — cardholder review / verification status. See Webhook Spec.
Webhook Delivery Status
Returned by /webhook_events/list as status / status_desc.
status | status_desc | Meaning |
|---|---|---|
| 0 | pending | Queued, not yet attempted |
| 1 | delivered | Your endpoint answered 2xx |
| 2 | failed_retry | Last attempt failed; another attempt is scheduled (next_attempt_at) |
| 3 | dead_letter | Retries exhausted (or the URL was rejected); no further attempts |
| 4 | skipped | Not delivered by design (e.g. no webhook URL configured) |
Card Types (v1.5 OpenAPI scope)
| card_type | Description |
|---|---|
virtual_l | Virtual card class L |
virtual_p | Virtual card class P |
virtual_v | Virtual card class V |
virtual_r | Virtual card class R |
virtual_g | Virtual card class G |
virtual_a | Virtual card class A (cardholder required since v1.6.8 — see Apply) |
virtual_s921 | Virtual card class S921 (USD; cardholder required since v1.6.8 — see Apply) |
OpenAPI rejects non-virtual types
master_e / visa_h / transfer etc. are out of scope and return HTTP 200 / 40000 openapi_card_type_not_supported.
apply does not accept card_type
/card/apply doesn't take card_type; it's derived from header_id.
Card Status
status in the /card/info, /cards/list, /card/apply, /card/freeze, /card/unfreeze and /card/close responses, and from_status_code / to_status_code in card.status_changed. The text form (status_desc, and from_status / to_status in the webhook) is always lowercase English and does not follow Accept-Language.
status | Text | Meaning |
|---|---|---|
| 1 | pending | Card open submitted, waiting for the provider |
| 2 | active | Usable |
| 3 | failed | Card open failed (terminal) |
| 4 | closing | Close requested; stays closing with its balance until the provider completes the close |
| 5 | closed | Closed, balance 0 (terminal unless the close refund is rejected in review, which restores active) |
| 6 | frozen | Frozen; see freeze_type |
/cards/list accepts statuses values 1–6; anything else returns HTTP 200 / 40000 openapi_invalid_status_value.
freeze_type (in /cards/list): 0 not frozen · 1 frozen by the cardholder (can be undone with /card/unfreeze) · 2 system · 3 platform admin · 4 risk control.
Recharge Status
status / status_desc in the /card/recharge response, and status in the card.recharged / card.recharge_failed webhooks.
status | status_desc | Meaning |
|---|---|---|
| 1 | processing | Accepted, result pending — wait for the webhook |
| 2 | success | Credited to the card (card.recharged) |
| 3 | failed | Failed, funds returned to the wallet (card.recharge_failed) |
Card Transactions
Applies to /transactions/list and /card/transactions/list.
type — raw provider type, upper-cased
The response type is the card provider's own transaction type, upper-cased. It is not a closed enum: values differ by card type and new ones can appear at any time. Examples seen in production: AUTHORIZATION, AUTH, CONSUMPTION, PURCHASE, RECHARGE, TOPUP, TOP UP, REFUND, CREDIT, REVERSAL, FEE, AUTHORIZATION_FEE, WITHDRAW, WITHDRAWAL. Top-ups of virtual_v / virtual_r / virtual_g / virtual_a / virtual_s921 cards appear as RECHARGE.
Do not branch on type. Branch on type_category and display type_i18n (localized names keyed by language code, e.g. en-US / zh-CN / zh-HK).
type_category — closed set
type_category | Meaning |
|---|---|
consumption | Purchase / settled authorization |
refund | Refund / credit back to the card |
reversal | Reversal of an earlier transaction |
topup | Card top-up (recharge) |
fee | Fee line |
close | Card-close entry |
transfer | Transfer |
withdraw | Withdrawal from the card |
interest | Interest |
3ds | 3-D Secure verification entry |
unknown | Type not classified yet (response only — cannot be used as a filter) |
Request filters
| Filter | Accepted values | Notes |
|---|---|---|
type_category | Any value above except unknown (case-sensitive) | Recommended. Matches exactly the rows whose response type_category is that value. Invalid value → HTTP 200 / 40000 invalid_params |
type | PURCHASE (alias CONSUMPTION), AUTHORIZATION, REFUND, REVERSAL, TOPUP (alias TOP_UP), WITHDRAW (alias WITHDRAWAL), FEE (case-insensitive) | Legacy standard enum, mapped to each provider's raw values — see below. Any other value is matched exactly (case-sensitive) against the provider's stored type |
When both type and type_category are sent, only rows matching both are returned.
type filter | Matches response type |
|---|---|
PURCHASE | AUTH (virtual_l), CONSUMPTION, AUTHORIZATION, PURCHASE |
AUTHORIZATION | Only virtual_p pre-authorizations (shown as AUTH). AUTHORIZATION in the response is a settled purchase on virtual_v / virtual_r cards and is matched by PURCHASE, not by this filter |
REFUND | REFUND, CREDIT |
REVERSAL | REVERSAL |
TOPUP | TOP UP, TOPUP, RECHARGE (v1.5: now includes the virtual_v / virtual_r / virtual_g / virtual_a / virtual_s921 top-ups) |
WITHDRAW | WITHDRAW, WITHDRAWAL |
FEE | FEE |
Prefer type_category
The type filter is kept for compatibility and is ambiguous (AUTH / AUTHORIZATION mean different things on different card types). Filter with type_category instead.
Hidden types
Some types are hidden from these endpoints by platform configuration — system cross-border fee lines and card-close entries by default; the platform may hide others (e.g. plain fee lines). A filter that targets only hidden types returns an empty list.
status
Response status | Filter value |
|---|---|
PENDING | PENDING |
APPROVED | APPROVED (alias COMPLETED) |
FAILED | FAILED |
REVERSED | REVERSED |
The status filter is case-insensitive. A provider status outside these four is returned unchanged.
Cardholders (v1.6)
See Cardholders for how these values are used.
| Item | Values |
|---|---|
| Card types that use cardholders | virtual_v / virtual_r / virtual_g / virtual_a / virtual_s921 — a cardholder is required on every header of these types since v1.6.8 (never virtual_l / virtual_p) |
registration_status | 0 draft · 1 registered |
bindings[].status | 1 submitting · 2 under review · 3 approved · 4 failed |
kyc.status | NOT_STARTED · IN_PROGRESS · APPROVED · REJECTED · CANCELLED (kyc_levels is deprecated and always []) |
issues[].rules | required_fields · identity_types · field_constraints · holder_age · poa_max_age_months · nationalities · blocked_nationalities · residence_countries · blocked_residence_countries · billing_countries · area_codes · poa_issuing_countries · kyc_required · max_cards_per_cardholder · issuer_check |
issues[].constraint | min_length · max_length · charset · format (empty otherwise) |
rules.field_constraints charset / format | LATIN_NAME · LATIN_TEXT · LATIN_ALNUM_DASH · DIGITS / EMAIL · ISO_DATE · ISO_COUNTRY · E164 |
rules.conditionals[].when.op | in · not_in · lt · gte |
review_status (check / submit, per header) | READY · NOT_SUBMITTED · PENDING_REVIEW · REJECTED · COVERAGE_INSUFFICIENT |
issues[].type | MISSING_FIELDS · INVALID_FIELDS · COUNTRY_RESTRICTION · KYC_REQUIRED · KYC_NOT_CONFIGURED · CARD_LIMIT |
bindings[].failure_reason | CARDHOLDER_FIELDS_INCOMPLETE · CARDHOLDER_KYC_REJECTED · CARDHOLDER_MOBILE_ALREADY_IN_USE · CARDHOLDER_EMAIL_ALREADY_IN_USE · CARDHOLDER_NATIONALITY_NOT_SUPPORTED · CARDHOLDER_BILLING_COUNTRY_NOT_ALLOWED · CARDHOLDER_AREA_CODE_NOT_SUPPORTED · CARDHOLDER_KYC_REFERENCE_DUPLICATE · CARDHOLDER_PROVIDER_REJECTED · CARDHOLDER_INVALID_PARAMETERS · CARDHOLDER_SUBMISSION_FAILED · CARDHOLDER_RESUBMISSION_REQUIRED · CARDHOLDER_KYC_PROOF_UNAVAILABLE · CARDHOLDER_PROVIDER_CONFIGURATION (other values possible — treat as a generic rejection) |
ID document identity.type | ID_CARD · PASSPORT · HK_HKID · DLN · RESIDENCE_PERMIT |
File purpose | identity_front · identity_back · identity_hand · proof_of_address |
| File types / size | JPG · PNG · PDF (detected from content), ≤ 2 MB |
gender | 0 not provided · 1 male · 2 female |
| Headers per check / submit | 1–20 |
external_id | ≤ 128 characters, [A-Za-z0-9._-], unique per account |
kyc/init access token validity | about 600 seconds |
detail refresh throttle | once per 30 seconds per cardholder |
| Legacy card candidates | at most 50, virtual_g / physical_g |
Business Prefixes
| Resource | Prefix | Example |
|---|---|---|
| Card | card_ | card_12345 |
| Package | pkg_ | pkg_67 |
| Card header | hdr_ | hdr_5 |
| Recharge transaction | txn_ | txn_OO20260429110012abc |
| Webhook event | evt_ | evt_550e8400-e29b-41d4-a716-446655440000 |
| Cardholder | chd_ | chd_1024 |
| Cardholder file | chf_ | chf_301 |
Useful SHA-256 Constants
| Input | sha256 hex |
|---|---|
| Empty string | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
{} | 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a |
Localization
The language of message is taken from Accept-Language, then the X-Language header, then the ?lang= query parameter.
| Request | message language |
|---|---|
| No language sent | English (en-US) |
zh-CN | Simplified Chinese |
zh-HK / zh-TW / zh-Hant / zh-MO | Traditional Chinese |
en-US | English |
| Other site languages | That language (may be machine-translated) |
| Unsupported language | English |
error_key is not affected by the language — always stable, use it (together with code) for programmatic checks. Never match on message.
Credentials
| Item | Value |
|---|---|
| Validity | Indefinite (until reset / disabled) |
| Per-user limit | 1 active credential pair (v1) |
| After reset | Old secret immediately invalid |
| After disable | HTTP 401 / 40100 / openapi_invalid_credentials; can re-enable |