# Response codes

> Review Account service response envelopes, success codes, and recommended troubleshooting actions.

Use this page when an Account service response returns a non-success response code. Always follow the response field names shown on the endpoint page you are calling.

<note>

Current account balance, account transaction, and account statement endpoints do not use `code` / `message` as the primary response envelope. They use `respCode` / `respMsg`, where `20000` means the request was processed successfully.

</note>

## Current Account service endpoints

Account balance and account transaction endpoints use the JSON response envelope `respCode` / `respMsg` / `data` / `error`.

The daily account statement export endpoint returns a CSV stream on success. It returns a JSON error response with `respCode`, `respMsg`, and `error` only when the request fails before the CSV response is committed.

| respCode | Default `respMsg` | Error type | Explanation | Recommended action |
| --- | --- | --- | --- | --- |
| `20000` | `Success` | - | The request was processed successfully. | Continue with the endpoint-specific `data` fields, account balance details, account transaction records, or pagination fields. For a successful statement export, read the CSV stream. |
| `10001` | `Invalid request parameter` | `invalid_request_error` | One or more request fields are missing, malformed, outside the allowed range, or use an unsupported enum value. | Compare the request with the endpoint schema, required fields, currency codes, enum values, timestamp requirements, query time ranges, and examples. |
| `10006` | `DUPLICATE_REQUEST` | `idempotency_error` | The `requestId` was reused within the idempotency window. | Confirm the original request result first. Use a new `requestId` only for a genuinely new operation. |

The `error` object carries standardized error details:

| Field | Description |
| --- | --- |
| `code` | External business error code, usually aligned with `respCode`. |
| `declineCode` | Compatibility field that usually mirrors `code` for current Account service APIs. |
| `message` | Human-readable error message. |
| `type` | Standardized error type, such as `invalid_request_error`, `idempotency_error`, or `api_error`. |
| `param` | Request parameter that caused the error, when applicable. |
| `requestId` | Caller request ID copied from body `requestId`. |

## Global Account endpoints

Global Account creation and detail APIs use the `success` / `respCode` / `respMsg` response envelope. The success response code is `20000`.

| respCode | Constant | Default `respMsg` | Explanation | Recommended action |
| --- | --- | --- | --- | --- |
| `20000` | `SUCCESS_CODE` | `Success` | The request was processed successfully. | Continue with the endpoint-specific `data` fields and Global Account status values. |
| `10001` | `INVALID_PARAMETER` | `Invalid request parameter` | One or more request fields are missing, malformed, outside the allowed range, or use an unsupported enum value. | Compare the request with the endpoint schema, required fields, enum values, query constraints, and examples. For detail queries, `globalAccountId` must be numeric, and at least one of `globalAccountId` or `globalAccountNo` is required. |
| `10002` | `INVALID_TIME_RANGE` | `Invalid query time range` | The query time range is invalid or exceeds the supported range for the request. | Adjust the start and end time according to the endpoint query constraints, then retry. |
| `10003` | `UNAUTHORIZED_ACCESS` | `Access denied` | The caller is not allowed to access the requested Account service resource or capability. | Check that the `apikey`, environment, merchant account, and IP allowlist match the requested resource. Contact Onerway support if access should be enabled. |
| `10004` | `RESOURCE_NOT_FOUND` | `Resource not found` | The requested Global Account or related business resource was not found. | Verify `globalAccountId`, `globalAccountNo`, environment, and merchant ownership. Do not retry blindly with the same identifier. |
| `10005` | `REQUEST_FAILED` | `Request failed` | The Account service could not complete the request. | Check the response message and request context. Retry only when the operation is safe to repeat or protected by idempotency. |
| `10006` | `DUPLICATE_REQUEST` | `Duplicate request` | The request duplicates a previous request or uses an idempotency identifier that has already been processed. | Query the existing result before sending another request. Use a new `requestId` only for a genuinely new operation. |
| `10007` | `INIT_GLOBAL_ACCOUNT_FAILED` | `Init Global Account failed` | Global Account initialization failed. | Check `customerId`, `onBehalfOf`, supported currencies, bank country or region, and account capability configuration. Contact Onerway support if the request data is valid. |
| `10008` | `GLOBAL_ACCOUNT_CUSTOMER_INVALID` | `Invalid customer id for Global Account` | The customer identifier cannot be used for the requested Global Account operation. | Confirm `customerId` belongs to the merchant account. For platform calls on behalf of a child customer, confirm `customerId` matches `onBehalfOf` and the parent-child relationship is valid. |
| `10009` | `GLOBAL_ACCOUNT_CALLER_NOT_AUTHORIZED` | `Caller identity does not match customer` | The caller identity does not match the customer associated with the Global Account resource. | Confirm that the `apikey`, merchant account, `customerId`, `onBehalfOf`, and Global Account identifier all belong to the same authorized relationship. |
