@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api NOWPayments API
@auth ApiKey x-api-key in header
@endpoints 35
@hint download_for_search
@toc subscriptions(9), sub-partner(9), estimate(1), payment(4), invoice-payment(1), min-amount(1), invoice(1), currencies(1), full-currencies(1), merchant(1), payout(3), balance(1), status(1), auth(1)

@group subscriptions
@endpoint POST /v1/subscriptions/plans
@required {title: str, interval_day: int, amount: int, currency: str}
@returns(200) {result: map}

@endpoint PATCH /v1/subscriptions/plans/:plan-id
@required {plan-id: str, title: str, interval_day: int, amount: int, currency: str}
@returns(200) {result: map}

@endpoint GET /v1/subscriptions/plans/:plan-id
@required {plan-id: str}
@returns(200) {result: map}

@endpoint GET /v1/subscriptions/plans
@optional {limit: str, offset: str}
@returns(200) {result: [map], count: int}

@endpoint POST /v1/subscriptions
@required {subscription_plan_id: int, email: str}
@returns(200) {result: map}

@endpoint GET /v1/subscriptions
@optional {status: str, subscription_plan_id: str, is_active: str, limit: str, offset: str}
@returns(200) {result: [map], count: int}

@endpoint GET /v1/subscriptions/:sub_id
@required {sub_id: str}
@returns(200) {result: map}

@endpoint DELETE /v1/subscriptions/:sub_id
@required {sub_id: str}
@returns(200) {result: str}

@endgroup

@group sub-partner
@endpoint POST /v1/sub-partner/balance
@required {name: str}
@returns(200) {result: map}

@endgroup

@group subscriptions
@endpoint POST /v1/subscriptions
@required {subscription_plan_id: int, sub_partner_id: int}
@returns(200) {result: map}

@endgroup

@group sub-partner
@endpoint GET /v1/sub-partner/balance/:id
@required {id: str}
@returns(200) {result: map}

@endpoint GET /v1/sub-partner
@optional {id: str, offset: str, limit: str, order: str}
@returns(200) {result: [map], count: int}

@endpoint GET /v1/sub-partner/transfers
@optional {id: str, status: str, limit: str, offset: str, order: str}
@returns(200) {result: [map], count: int}

@endpoint GET /v1/sub-partner/transfer/:id
@required {id: str}
@returns(200) {result: map}

@endpoint POST /v1/sub-partner/transfer
@required {currency: str, amount: num, from_id: int, to_id: int}

@endpoint POST /v1/sub-partner/payment
@required {currency: str, amount: num, sub_partner_id: str, fixed_rate: bool}
@returns(200) {result: map}

@endpoint POST /v1/sub-partner/deposit
@required {currency: str, amount: num, sub_partner_id: str}

@endpoint POST /v1/sub-partner/write-off
@required {currency: str, amount: num, sub_partner_id: str}

@endgroup

@group estimate
@endpoint GET /v1/estimate
@optional {amount: str, currency_from: str, currency_to: str}
@returns(200) {currency_from: str, amount_from: num, currency_to: str, estimated_amount: num}

@endgroup

@group payment
@endpoint POST /v1/payment
@required {price_amount: num, price_currency: str, pay_currency: str, ipn_callback_url: str, order_id: str, order_description: str, is_fixed_rate: bool, is_fee_paid_by_user: bool}
@returns(201) {payment_id: str, payment_status: str, pay_address: str, price_amount: num, price_currency: str, pay_amount: num, pay_currency: str, order_id: str, order_description: str, ipn_callback_url: str, created_at: str, updated_at: str, purchase_id: str, amount_received: any?, payin_extra_id: any?, smart_contract: str, network: str, network_precision: int, time_limit: any?, burning_percent: any?, expiration_estimate_date: str}

@endgroup

@group invoice-payment
@endpoint POST /v1/invoice-payment
@returns(201) {payment_id: str, payment_status: str, pay_address: str, price_amount: num, price_currency: str, pay_amount: num, pay_currency: str, order_id: str, order_description: str, ipn_callback_url: str, created_at: str, updated_at: str, purchase_id: str, amount_received: any?, payin_extra_id: any?, smart_contract: str, network: str, network_precision: int, time_limit: any?, burning_percent: any?, expiration_estimate_date: str}

@endgroup

@group payment
@endpoint POST /v1/payment/:id/update-merchant-estimate
@required {id: str}
@returns(200) {id: str, token_id: str, pay_amount: num, expiration_estimate_date: str}

@endpoint GET /v1/payment/:payment_id
@required {payment_id: str}
@returns(200) {payment_id: int, payment_status: str, pay_address: str, price_amount: int, price_currency: str, pay_amount: num, actually_paid: int, pay_currency: str, order_id: str, order_description: str, purchase_id: str, created_at: str, updated_at: str, outcome_amount: num, outcome_currency: str}

@endgroup

@group min-amount
@endpoint GET /v1/min-amount
@optional {currency_from: str, currency_to: str}
@returns(200) {currency_from: str, currency_to: str, min_amount: num, fiat_equivalent: num}

@endgroup

@group payment
@endpoint GET /v1/payment/
@optional {limit: str, page: str, sortBy: str, orderBy: str, dateFrom: str, dateTo: str}
@returns(200) {data: [map], limit: int, page: int, pagesCount: int, total: int}

@endgroup

@group invoice
@endpoint POST /v1/invoice
@required {price_amount: int, price_currency: str, order_id: str, order_description: str, ipn_callback_url: str, success_url: str, cancel_url: str, partially_paid_url: str, is_fixed_rate: bool, is_fee_paid_by_user: bool}
@returns(201) {id: str, order_id: str, order_description: str, price_amount: str, price_currency: str, pay_currency: any?, ipn_callback_url: str, invoice_url: str, success_url: str, cancel_url: str, created_at: str, updated_at: str}

@endgroup

@group currencies
@endpoint GET /v1/currencies
@returns(200) {currencies: [str]}

@endgroup

@group full-currencies
@endpoint GET /v1/full-currencies

@endgroup

@group merchant
@endpoint GET /v1/merchant/coins
@returns(200) {currencies: [str]}

@endgroup

@group payout
@endpoint POST /v1/payout
@required {ipn_callback_url: str, withdrawals: [map]}
@returns(200) {id: str, withdrawals: [map]}

@endpoint GET /v1/payout/<payout_id>

@endgroup

@group balance
@endpoint GET /v1/balance
@returns(200) {eth: map, trx: map, xmr: map}

@endgroup

@group payout
@endpoint POST /v1/payout/:withdrawals-id/verify
@required {withdrawals-id: str, verification_code: str}

@endgroup

@group status
@endpoint GET /v1/status
@returns(200) {message: str}

@endgroup

@group auth
@endpoint POST /v1/auth
@required {email: str, password: str}
@returns(200) {token: str}

@endgroup

@end
