nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Reseller

Send money to a user

posthttps://api.nsin.ir/reseller/v1/users/{id}/wallet/transfer

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

Moves money from your wallet to the user's. Only your balance can be sent, never your credit line: you must stay at zero or above.

Send a fresh idempotency_key for each transfer and reuse it only to retry the same transfer after a timeout; a retry answers already_applied: true instead of moving the money twice. Reusing a key for another user or amount is refused.

Path parameters

  • idintegerrequiredpath

    The id of one of your users.

Request body

Content type: application/json · required

  • amount_rialsinteger (int64)required
  • idempotency_keystringrequired

    Unique per movement; reuse only to retry the same one.

Responses

200Done (or done before, with already_applied).

Content type: application/json

  • amount_rialsinteger (int64)
  • reseller_balance_rialsinteger (int64)
  • account_balance_rialsinteger (int64)
  • reclaimable_rialsinteger (int64)

    What you could take back from this user now.

  • already_appliedboolean

    This key was used before; nothing moved this time.

json
{
  "amount_rials": 0,
  "reseller_balance_rials": 0,
  "account_balance_rials": 0,
  "reclaimable_rials": 0,
  "already_applied": true
}
400amount_rials is not positive, or idempotency_key is missing or longer than 64 characters.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
401Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "invalid API key"
}
402Your balance is too low (the credit line can't be sent).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
403The key is read-only and this endpoint is a write. Read-only keys may only issue GET, HEAD and OPTIONS.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No user with this id among yours.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "user not found"
}
409The idempotency key was already used for a different transfer.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}

Example request

bash
curl -X POST "https://api.nsin.ir/reseller/v1/users/0/wallet/transfer" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "amount_rials": 5000000,
  "idempotency_key": "c1b7b0a2-3f4e-4c51-9a1e-2b6f8f0d1e11"
}'
esc