Migration from API v1
Upgrade from Nexchange API v1 to the improved v2 interface with cleaner field names, better structure, and enhanced developer experience while maintaining full backward compatibility.
Why Upgrade to API v2?β
Key Improvements in v2β
- π― Intuitive Field Names:
sideinstead oforder_type,deposit_amountinstead ofamount_quote - π Flat Structure: No nested objects, all fields at the top level
- π€ String Values:
"BUY"instead of numeric codes like0 - π§Ή Cleaner Responses: Removed deprecated and unnecessary fields
- π Better Documentation: More descriptive field names and clearer concepts
- π Consistent Endpoints: Simplified URL structure and standardized naming
- π API Key Required: All endpoints now require API key authentication for security
Base URL Changesβ
v1 Base URL:
https://api.n.exchange/en/api/v1/
v2 Base URL:
https://api.n.exchange/en/api/v2/
Field Mapping Referenceβ
Ordersβ
| v1 Field | v2 Field | Change Type | Description |
|---|---|---|---|
order_type | side | Renamed | Now uses "BUY" or "SELL" strings |
amount_base | withdraw_amount | Renamed | More descriptive naming |
amount_quote | deposit_amount | Renamed | More descriptive naming |
pair.base | withdraw_currency | Flattened | Currency code only (string) |
pair.quote | deposit_currency | Flattened | Currency code only (string) |
status_name[0][1] | status | Simplified | Flat string status |
payment_window | payment_window_minutes | Renamed | Clearer units |
payment_deadline | fixed_rate_deadline | Renamed | More descriptive |
transactions[].tx_id | deposit_transaction, withdraw_transaction | Split | Separate fields by type |
withdraw_extra_id, refund_extra_id | withdraw_address_extra_id, refund_address_extra_id | Renamed | Canonical v2 extra-ID names |
v1 exposes numeric status codes (via status_name); v2 responses return the status string ("PAID"). The GET /orders/?status= list filter still accepts the numeric code. The full integerβstring mapping is in Order Lifecycle.
v1 list endpoints use page-number pagination; the v2 order list uses cursor pagination (pagination.next / pagination.previous, no total count) and contains CeFi orders only β see List Orders.
Pairsβ
| v1 Field | v2 Field | Change Type | Description |
|---|---|---|---|
base | to | Renamed | Currency you receive |
quote | from | Renamed | Currency you send |
fee_ask, fee_bid | removed | Deprecated | Simplified response |
test_mode | removed | Deprecated | No longer needed |
orderbook_enabled | removed | Deprecated | No longer needed |
reverse_orderbook_enabled | removed | Deprecated | No longer needed |
Ratesβ
| v1 Field | v2 Field | Change Type | Description |
|---|---|---|---|
max_receive_amount | max_withdraw_amount | Renamed | More descriptive |
min_receive_amount | min_withdraw_amount | Renamed | More descriptive |
allowed_historic_price_variance | removed | Deprecated | No longer needed |
allowed_historic_price_age | removed | Deprecated | No longer needed |
max_amount | removed | Deprecated | Replaced by specific limits |
min_amount | removed | Deprecated | Replaced by specific limits |
Pre-screeningβ
| v1 Field | v2 Field | Change Type | Description |
|---|---|---|---|
amount_quote | deposit_amount | Renamed | More descriptive |
amount_base | withdraw_amount | Renamed | More descriptive |
detail | status, message | Split | Structured response |
Endpoint Changesβ
Currency Endpointsβ
| v1 Endpoint | v2 Endpoint | Changes |
|---|---|---|
GET /currency/ | GET /currency/ | β Same endpoint |
GET /currency/{code}/ | GET /currency/{code}/ | β Same endpoint |
| - | GET /network/ | π New: List networks |
| - | GET /network/{name}/ | π New: Get network details |
Trading Pair Endpointsβ
| v1 Endpoint | v2 Endpoint | Changes |
|---|---|---|
GET /pair/ | GET /pair/ | β Same endpoint, simplified response |
GET /pair/{name}/ | GET /pair/{name}/ | β Same endpoint, simplified response |
Rate Endpointsβ
| v1 Endpoint | v2 Endpoint | Changes |
|---|---|---|
GET /info/bulk/ | GET /rate/ | π Renamed: Cleaner endpoint name |
Order Endpointsβ
| v1 Endpoint | v2 Endpoint | Changes |
|---|---|---|
GET /orders/ | GET /orders/ | β Same endpoint, simplified response |
POST /orders/ | POST /orders/ | β Same endpoint, simplified request/response |
GET /orders/{unique_reference}/ | GET /orders/{unique_reference}/ | β Same endpoint, simplified response |
PATCH /orders/{unique_reference}/ | PATCH /orders/{unique_reference}/ | β Same endpoint, simplified request |
Risk Management Endpointsβ
| v1 Endpoint | v2 Endpoint | Changes |
|---|---|---|
POST /pre_screening/ | POST /pre_screening/ | β Same endpoint, structured response |
Migration Examplesβ
1. Get Trading Pairsβ
v1 Endpoint:
curl -X GET "https://api.n.exchange/en/api/v1/pair/" \
-H "Accept: application/json" \
-H "Authorization: ApiKey api_key"
v1 Response:
[
{
"name": "BTCUSDC",
"base": "BTC",
"quote": "USDC",
"fee_ask": "0.005",
"fee_bid": "0.005",
"disabled": false,
"test_mode": false,
"orderbook_enabled": true,
"reverse_orderbook_enabled": false
}
]
v2 Endpoint:
curl -X GET "https://api.n.exchange/en/api/v2/pair/" \
-H "Accept: application/json" \
-H "Authorization: ApiKey api_key"
v2 Response:
[
{
"name": "BTCUSDC",
"to": "BTC",
"from": "USDC",
"disabled": false
}
]
2. Get Ratesβ
v1 Endpoint:
curl -X GET "https://api.n.exchange/en/api/v1/info/bulk/" \
-H "Accept: application/json" \
-H "Authorization: ApiKey api_key"
v1 Response:
[
{
"pair": "BTCUSDC",
"rate": "45000.00",
"max_receive_amount": "10.00000000",
"min_receive_amount": "0.00100000",
"allowed_historic_price_variance": "0.05",
"allowed_historic_price_age": "300",
"max_amount": "500000.00",
"min_amount": "50.00"
}
]
v2 Endpoint:
curl -X GET "https://api.n.exchange/en/api/v2/rate/" \
-H "Accept: application/json" \
-H "Authorization: ApiKey api_key"
v2 Response:
[
{
"pair": "BTCUSDC",
"from": "USDC",
"to": "BTC",
"withdrawal_fee": "0.00050000",
"rate": "45000.00",
"rate_id": "abc123-000000",
"max_withdraw_amount": "10.00000000",
"min_withdraw_amount": "0.00100000",
"max_deposit_amount": "500000.00",
"min_deposit_amount": "50.00",
"expiration_time_unix": "1697365800"
}
]
3. Create Orderβ
v1 Endpoint:
curl -X POST "https://api.n.exchange/en/api/v1/orders/" \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey api_key" \
-d '{
"amount_base": "0.01000000",
"pair_name": "BTCUSDC",
"withdraw_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
}'
v1 Request:
{
"amount_base": "0.01000000",
"pair_name": "BTCUSDC",
"withdraw_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
}
v2 Endpoint:
curl -X POST "https://api.n.exchange/en/api/v2/orders/" \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey api_key" \
-d '{
"withdraw_amount": "0.01000000",
"deposit_currency": "USDC",
"withdraw_currency": "BTC",
"withdraw_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
}'
v2 Request:
{
"withdraw_amount": "0.01000000",
"deposit_currency": "USDC",
"withdraw_currency": "BTC",
"withdraw_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
}
side defaults to BUYCrypto swaps are always BUY (the default) β omit side entirely. SELL applies to fiat orders only. This differs from v1's numeric order_type.
4. Pre-screening Requestβ
v1 Request:
{
"ip": "192.168.1.1",
"pair": "BTCUSDC",
"amount_quote": "50000.0"
}
v1 Response:
{
"detail": "Pre-screening passed."
}
v2 Request:
{
"ip": "192.168.1.1",
"pair": "BTCUSDC",
"deposit_amount": "50000.0"
}
v2 Response:
{
"status": "success",
"message": "Pre-screening passed."
}
Step-by-Step Migrationβ
Step 1: Update Base URLsβ
Update all your API calls to use the v2 base URL:
// Before (v1)
const BASE_URL = 'https://api.n.exchange/en/api/v1/';
// After (v2)
const BASE_URL = 'https://api.n.exchange/en/api/v2/';
Step 2: Update Endpoint URLsβ
Replace changed endpoint names:
// Before (v1)
const ratesUrl = `${BASE_URL}info/bulk/`;
// After (v2)
const ratesUrl = `${BASE_URL}rate/`;
Step 3: Add Authorization headerβ
"Authorization: ApiKey api_key"
Step 4: Update Field Namesβ
Replace old field names with new ones:
// Before (v1)
const orderData = {
amount_base: "0.01",
pair_name: "BTCUSDC",
order_type: 0 // numeric code
};
// After (v2)
const orderData = {
withdraw_amount: "0.01",
deposit_currency: "USDC",
withdraw_currency: "BTC"
// side omitted β crypto swaps default to "BUY"
};
Step 5: Handle Response Changesβ
Update response parsing logic:
// Before (v1) - nested pair structure
const baseCurrency = response.pair.base;
const quoteCurrency = response.pair.quote;
const status = response.status_name[0][1];
// After (v2) - flat structure
const withdrawCurrency = response.withdraw_currency;
const depositCurrency = response.deposit_currency;
const status = response.status;
Step 6: Remove Deprecated Fieldsβ
Remove handling of deprecated fields:
// Remove these from v1 response parsing:
// - fee_ask, fee_bid
// - test_mode, orderbook_enabled
// - allowed_historic_price_variance
// - allowed_historic_price_age
// - max_amount, min_amount (use specific limits instead)
Migration Checklistβ
- Update base URLs from
/v1/to/v2/ - Replace
amount_basewithwithdraw_amount - Replace
amount_quotewithdeposit_amount - Replace nested
pair.basewith flatwithdraw_currency - Replace nested
pair.quotewith flatdeposit_currency - Replace
order_typenumeric values withsidestrings - Update status parsing from
status_name[0][1]tostatus - Replace
/info/bulk/with/rate/endpoint - Update transaction handling from nested arrays to flat fields
- Remove handling of deprecated fields
- Update pre-screening response parsing to use
statusandmessage - Test all endpoints with new field names
- Update error handling for new response format
Backward Compatibilityβ
Don't worry about breaking changes:
- v1 endpoints remain fully functional - No rush to migrate
- Same business logic - v2 inherits all v1 functionality
- Gradual migration - Migrate endpoints one by one
- Side-by-side operation - Run both versions simultaneously during transition
Endpoints without a direct v2 equivalentβ
| v1 endpoint | v2 replacement |
|---|---|
/info/bulk/ | GET /rate/ |
/get_price/{pair}/ | GET /rate/?pairs=<pair>&deposit_amount=<amount> β the response's withdraw_amount preview is the exact user-facing quote |
/oauth2/token, /users/me, /user/me/orders | No v2 equivalent β v2 uses API key + referral token; user-scoped history stays on v1 |
New Features in v2β
Enhanced Filteringβ
- Rate filtering:
fiat_only,crypto_only, contract-address selectors,deposit_amountpreviews,include_etaβ see Rates
Network Informationβ
- Network endpoints: New
/network/endpoints for blockchain network details - Enhanced currency info: Better token and network information
Improved Error Handlingβ
- Structured errors:
{detail, errors}format with field-specific messages β see Errors & Rate Limits
Need Help?β
- π v2 API Reference - Complete v2 documentation
- π¬ Support - Contact our team for migration assistance
Ready to start? Try our Quick Start Guide guide! π
Next Stepsβ
- Quick Start - Get started with API v2
- API Reference - Complete v2 documentation
- FAQ - Frequently asked questions
Questions about migration? Contact our support team for assistance with upgrading your integration.