Account and Access Credentials
Login, registration, verification codes, password reset, sub-accounts, test accounts, sandbox tokens and developer app (API token) management for the channel partner portal.
Every endpoint on this page is POST with JSON request and response bodies. Successful responses use { code, msg, data, timestamp }; error responses use { code, msg, timestamp } and do not include data. code = 200 means success and any other value is a business error code.
Authentication Model
The platform uses three kinds of opaque random credentials with distinct scopes:
| Credential | Transport | Issued by | Lifetime | Applies to |
|---|---|---|---|---|
| Session token | Authorization: Bearer <token> | auth/login, auth/code/login, auth/password/change, auth/password/reset/confirm | 7 days | All signed-in endpoints: accounts, test accounts, sandbox, developer and reconciliation |
| Developer token (request-token) | request-token: <secret> | developer/create, developer/regenerate, or an admin-created app | Until disabled or rotated | Business endpoints: orders, outbound, inventory, reconciliation, webhooks. Not accepted by developer management endpoints |
| Sandbox token | Authorization: Bearer <token> or request-token: <token> | Created by sandbox/init in the test environment | Controlled by the test environment | Business endpoints served by the test environment (tapi) |
Notes:
- Account, test-account, sandbox, developer-management and reconciliation endpoints require a valid session token; business endpoints may use
request-token. - Clients never supply a member ID.
- Account and reconciliation endpoints do not check capabilities; outbound, inventory and webhook endpoints return
606when a capability is missing. - Verification codes are 6 digits, valid for 120 seconds, and single-use.
Authentication (auth)
Password Login
/channel/api/v1/auth/loginAuth: public (no token)
Sign in with email and password. Returns a session token and the user profile.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Login email, case-insensitive |
password | string | yes | Login password |
Response
{
"code": 200,
"msg": "success",
"data": {
"token": "5f1c0e...64 hex characters",
"user": {
"id": 42,
"member_id": 42,
"email": "buyer@example.com",
"name": "Example Trading",
"role": "admin",
"is_primary": true,
"user_type": "buyer",
"capabilities": ["outbound_submit"]
}
}
}Note: user.user_type may be returned only in sub-account / member-account scenarios, and only when the member has business identities; it may be absent and clients must not assume it is always present.
Error Codes
| code | Meaning |
|---|---|
| 400 | Missing email or password; wrong email or password (Invalid email or password) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"email": "buyer@example.com",
"password": "secret123"
}'Send Login Code
/channel/api/v1/auth/code/sendAuth: public (no token)
Send a 6-digit login code to an email address. The code is delivered by the mail channel and is never returned in the response.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Recipient email |
Response
{ "code": 200, "msg": "success", "data": { "sent": true, "expires_in": 120 } }Error Codes
| code | Meaning |
|---|---|
| 400 | Empty or invalid email |
| 500 | Mail delivery failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/code/send' \
-H 'Content-Type: application/json' \
-d '{
"email": "buyer@example.com"
}'Code Login
/channel/api/v1/auth/code/loginAuth: public (no token)
Sign in with email and an email verification code. Returns the same token and user shape as password login.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Login email |
code | string | yes | 6-digit single-use code |
Response
{
"code": 200,
"msg": "success",
"data": {
"token": "5f1c0e...64 hex characters",
"user": {
"id": 42,
"member_id": 42,
"email": "buyer@example.com",
"name": "Example Trading",
"role": "admin",
"is_primary": true,
"user_type": "buyer",
"capabilities": ["outbound_submit"]
}
}
}Note: user.user_type may be returned only in sub-account / member-account scenarios, and only when the member has business identities; it may be absent.
Error Codes
| code | Meaning |
|---|---|
| 400 | Invalid or expired code; no active account for this email (account not found) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/code/login' \
-H 'Content-Type: application/json' \
-d '{
"email": "buyer@example.com",
"code": "123456"
}'Register
/channel/api/v1/auth/registerAuth: public (no token)
This endpoint is currently unavailable. Contact the administrator to open an account.
Current User
/channel/api/v1/auth/meAuth: Authorization: Bearer <session token>
Return the signed-in user profile. No request body.
Response
{
"code": 200,
"msg": "success",
"data": {
"id": 42,
"member_id": 42,
"email": "buyer@example.com",
"name": "Example Trading",
"role": "admin",
"is_primary": true,
"user_type": "buyer,warehouse",
"capabilities": ["outbound_submit", "inventory_view"]
}
}| Field | Type | Description |
|---|---|---|
id | integer | Account ID |
member_id | integer | Owning channel partner member ID |
email | string | Login email |
name | string | Display name |
role | string | admin / operator / viewer |
is_primary | boolean | Whether this is the primary account |
user_type | string | Business identities, comma-separated; returned only when present on the member |
capabilities | string[] | Enabled partner capabilities |
Notes:
- This endpoint does not return a menu or permission tree (there is no
menufield). Portal navigation is configured client-side; the API exposesroleandcapabilitiesonly. - Returns the current signed-in account.
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing Authorization, or invalid / expired token |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/me' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Update Profile Name
/channel/api/v1/auth/profile/updateAuth: Authorization: Bearer <session token>
Update the member display name. Email is read-only and cannot be changed here.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | New name, 1–100 characters after trimming |
Response
{ "code": 200, "msg": "success", "data": { "name": "New Name" } }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Empty name or longer than 100 characters |
| 404 | Member not found |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/profile/update' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "New Name"
}'Change Password (signed in)
/channel/api/v1/auth/password/changeAuth: Authorization: Bearer <session token>
Verify the old password, set a new one and issue a new session token.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
old_password | string | yes | Current password |
new_password | string | yes | New password, at least 8 characters and different from the old one |
Response
{ "code": 200, "msg": "success", "data": { "token": "new session token" } }Notes:
- The previous session token is not revoked immediately; it remains valid until its 7-day TTL expires. Clients should discard it.
- Changes the password of the current signed-in account.
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Wrong old password; new password shorter than 8 characters; new password equals the old one |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/password/change' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"old_password": "secret123",
"new_password": "secret456"
}'Send Password Reset Code
/channel/api/v1/auth/password/reset/sendAuth: public (no token)
Send a reset code to an existing active account email.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Account email |
Response
{ "code": 200, "msg": "success", "data": { "sent": true, "expires_in": 120 } }Error Codes
| code | Meaning |
|---|---|
| 400 | Empty or invalid email; no active login account for this email (account not found) |
| 500 | Mail delivery failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/password/reset/send' \
-H 'Content-Type: application/json' \
-d '{
"email": "buyer@example.com"
}'Confirm Password Reset
/channel/api/v1/auth/password/reset/confirmAuth: public (no token)
Verify the email code, set a new password and return a session token.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Account email |
code | string | yes | 6-digit verification code |
password | string | yes | New password, at least 8 characters |
Response
{ "code": 200, "msg": "success", "data": { "token": "new session token" } }Error Codes
| code | Meaning |
|---|---|
| 400 | Invalid or expired code; password shorter than 8 characters; account not found |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/password/reset/confirm' \
-H 'Content-Type: application/json' \
-d '{
"email": "buyer@example.com",
"code": "123456",
"password": "secret456"
}'List Sub-accounts
/channel/api/v1/auth/accounts/listAuth: Authorization: Bearer <session token>
List every member account of the current partner, primary account first and then by ascending id. No request body.
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 42,
"member_id": 42,
"email": "owner@example.com",
"name": "Owner",
"role": "admin",
"is_primary": 1,
"active": 1,
"created_at": "2026-01-01 10:00:00",
"updated_at": "2026-01-01 10:00:00"
},
{
"id": 57,
"member_id": 42,
"email": "ops@example.com",
"name": "Ops",
"role": "operator",
"is_primary": 0,
"active": 1,
"created_at": "2026-02-01 09:00:00",
"updated_at": "2026-02-01 09:00:00"
}
]
}| Field | Type | Description |
|---|---|---|
id | integer | Member account ID |
member_id | integer | Owning channel partner member ID |
email | string | Login email |
name | string | Display name |
role | string | admin / operator / viewer |
is_primary | integer | 1 for the primary account |
active | integer | 1 enabled, 0 disabled |
created_at / updated_at | string | Creation / update time |
Note: the response returns account information without the password.
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/accounts/list' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Create / Update Sub-account
/channel/api/v1/auth/accounts/saveAuth: Authorization: Bearer <session token>
id = 0 creates a sub-account; id > 0 updates one. Requires the admin role or the primary account.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | no | 0 / omitted to create, otherwise the account ID to update |
email | string | yes | Login email, lower-cased and trimmed; must not collide with another account or another member |
name | string | no | Display name |
role | string | no | admin / operator / viewer, default operator |
password | string | required on create | At least 8 characters; leave empty on update to keep it unchanged |
active | boolean | no | Enabled flag; defaults to 0 on create, applied as sent on update |
Notes:
- Updates are full overwrites: the server always builds
name = '',role = 'operator'andactive = 0first, then writes the whole row. On update, omittingnameclears the name, omittingroledrops it tooperator, and omittingactivedisables the account. Clients should send the complete field set when editing. - The primary row is forced to
role = adminandactive = 1, and its email, name and password are mirrored intomember. - Duplicate email in
accountormemberreturns400 email already used.
Response
{ "code": 200, "msg": "success", "data": { "id": 57 } }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 606 | Caller is neither admin nor the primary account (admin role required) |
| 400 | Invalid email / invalid role / email already used / missing password on create / password shorter than 8 characters |
| 404 | Account to update not found or not owned by this member |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/accounts/save' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 57,
"email": "ops@example.com",
"name": "Ops",
"role": "operator",
"password": "secret123",
"active": true
}'Disable Sub-account
/channel/api/v1/auth/accounts/deleteAuth: Authorization: Bearer <session token>
Soft-disable a sub-account (active = 0); nothing is physically deleted. Requires the admin role or the primary account.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Member account ID; must not be the caller's own account or the primary account |
Response
{ "code": 200, "msg": "success", "data": null }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 606 | admin role required |
| 400 | Invalid id, equal to the caller's account, or the primary account (primary account cannot be disabled) |
| 404 | Account not found or not owned by this member |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/accounts/delete' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 57
}'Send Sub-account Reset Code
/channel/api/v1/auth/accounts/send-resetAuth: Authorization: Bearer <session token>
Send a password reset code to the sub-account email. The account then completes the reset through auth/password/reset/confirm.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Member account ID |
Response
{ "code": 200, "msg": "success", "data": { "sent": true } }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 606 | admin role required |
| 404 | Account not found or not owned by this member |
| 500 | Mail delivery failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/auth/accounts/send-reset' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 57
}'Test Accounts (test-account)
These endpoints accept only Authorization: Bearer <session token>. Developer secrets (including sandbox developer secrets) are not accepted and return 909. The test-account binding is production data.
Provision Test Account
/channel/api/v1/test-account/provisionAuth: Authorization: Bearer <session token>
Create (or return) the sandbox test email for the current member. Each member has a single test-account binding, so repeated calls are idempotent. No request body.
Response
{
"code": 200,
"msg": "success",
"data": {
"id": 42,
"tapi_email": "test_1a2b3c4d@e2c-energy.com",
"remark": "",
"is_current": true,
"created_at": "2026-11-11 10:00:00"
}
}| Field | Type | Description |
|---|---|---|
id | integer | Binding ID, equal to the member ID |
tapi_email | string | Test-environment login email |
remark | string | Remark |
is_current | boolean | Always true for the current binding |
created_at | string | Last update time (from the member updated_at) |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing or invalid session token |
| 400 | Member not found |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/test-account/provision' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'List Test Accounts
/channel/api/v1/test-account/listAuth: Authorization: Bearer <session token>
Return the current member's test-account bindings, or an empty array when none exists. No request body.
Response
{ "code": 200, "msg": "success", "data": [] }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/test-account/list' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Read Sandbox Token
/channel/api/v1/test-account/tokenAuth: Authorization: Bearer <session token>
Return the test-environment token written by sandbox/init. Any other fields in the request body are ignored.
Response
{ "code": 200, "msg": "success", "data": { "token": "test environment token" } }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Sandbox is not initialized for this member (sandbox environment is not initialized for this member) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/test-account/token' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Unbind Test Account
/channel/api/v1/test-account/unbindAuth: Authorization: Bearer <session token>
Remove the current member's test-account binding and clear the test email and remark.
Note: this does not revoke the stored sandbox_token; the test-environment token may still be valid after unbinding. Revoke it separately in the test environment or backend if needed.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Binding ID; must equal the current member ID |
Response
{ "code": 200, "msg": "success", "data": null }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Missing id; binding not found (test account binding not found) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/test-account/unbind' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 42
}'Sandbox Environment (sandbox)
Initialize Sandbox
/channel/api/v1/sandbox/initAuth: Authorization: Bearer <session token>
Create or ensure the current member's test account and test token in the test environment. The caller must be signed in with the admin role. No request body. 3. The returned test_env_token is persisted as the member's sandbox_token.
Response
{
"code": 200,
"msg": "sandbox environment initialized",
"data": { "member_id": 42, "sandbox_token": "test environment token" }
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated; or the caller is not admin (admin role required) |
| 400 | The sandbox admin token is not configured; or the test-environment call failed (sandbox init failed: ...) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/sandbox/init' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Read Sandbox Token
/channel/api/v1/sandbox/tokenAuth: Bearer or request-token (channel_partner)
Return the stored sandbox token for the current member. No request body. When uninitialized, sandbox_token is null rather than an error.
Response
{ "code": 200, "msg": "success", "data": { "member_id": 42, "sandbox_token": null } }Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated or not a channel partner |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/sandbox/token' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Developer Apps (developer)
These endpoints require Authorization: Bearer <session token>. Developer management does not accept request-token, because the controller resolves the member from the Authorization header only (and only as a session token, not a developer secret).
developer/create, developer/state and developer/regenerate are currently unavailable. Contact the administrator. developer/list is available.
Create App
/channel/api/v1/developer/createAuth: Authorization: Bearer <session token>
Create a channel_partner app and return its full token. The token is returned only once, in this response.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | App name |
Current Response
Returns 500 (framework error response, { code, msg, timestamp }) and no app data.
Fields (when available)
| Field | Type | Description |
|---|---|---|
id | integer | App ID |
name | string | App name |
token | string | Full token, returned only once |
token_preview | string | Masked token: first 4 characters + min(12, length-8) * + last 4 characters |
state | integer | 1 enabled |
created_at | string | Creation time |
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Missing name |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/developer/create' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "My ERP integration"
}'Currently unavailable.
List Apps
/channel/api/v1/developer/listAuth: Authorization: Bearer <session token>
List the current member's apps; tokens are returned as masked previews only. No request body.
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 12,
"name": "My ERP integration",
"token_preview": "abcd************wxyz",
"state": 1,
"created_at": "2026-11-11 10:00:00",
"last_used_at": "2026-11-11 12:30:00"
}
]
}| Field | Type | Description |
|---|---|---|
id | integer | App ID |
name | string | App name |
token_preview | string | Masked token: first 4 characters + min(12, length-8) * + last 4 characters; all * when the length is ≤ 8 |
state | integer | 1 enabled, 0 disabled |
created_at | string | Creation time |
last_used_at | string/null | Last time this token was used |
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/developer/list' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Enable / Disable App
/channel/api/v1/developer/stateAuth: Authorization: Bearer <session token>
Change app state. A disabled token stops authenticating immediately.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | App ID |
state | integer | yes | 1 enable, 0 disable |
Current Response
This endpoint is currently unavailable.
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Missing id or state not 0/1 |
| 404 | App not found or not owned by this member |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/developer/state' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 12,
"state": 1
}'Currently unavailable.
Rotate App Token
/channel/api/v1/developer/regenerateAuth: Authorization: Bearer <session token>
Generate a new app token that takes effect immediately; the old token stops working at once. The new token is returned only once.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | App ID |
Current Response
This endpoint is currently unavailable.
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated |
| 400 | Missing id |
| 404 | App not found or not owned by this member |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/developer/regenerate' \
-H 'Authorization: Bearer YOUR_SESSION_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 12
}'Currently unavailable.