API documentation

Connect your own application with Nocks.

The Nocks API is build on the REST priciple. All messages from the API, including errors, are in JSON format.

To prevent misuse of our API, only a maximum of 3 pending transactions are allowed per IP.

Price calculation

Before you start a transaction you can calculate the price.

Method: POST

URL: https://nocks.co/api/price

Name Type Example Description Required
pair string NLG_BTC NLG_BTC or BTC_NLG Yes
amount float 0.001 Amount to be send to 'withdrawal' address. Yes
fee string yes / no Calculate amount including fee. No

JSON Payload example

{
    "pair": "NLG_BTC",
    "amount": "0.001"
}

JSON Response success example

{
    "success":{
        "amount":"308.8685",
    },
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/price"
        }
    }
}

JSON Response error example

{
    "error": "Message here",
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/price"
        }
    }
}

Create transaction

Tip: You can create a reusable deposit address by not providing a amount value.

Method: POST

URL: https://nocks.co/api/transaction

Name Type Example Description Default Required
pair string NLG_BTC NLG_BTC or BTC_NLG Yes
withdrawal string 13qF4vRgCuAfMj6rcfhKz5RTfd9UiY92Ls Receiving address. Yes
amount float 0.001 No
amountType string withdrawal or deposit Amount is provided for withdrawal or deposit. withdrawal No
fee string withdrawal or deposit Charge fee on 'withdrawal' or 'deposit' address. deposit No
responseUrl string HTTP website URL Will be called with a POST value 'transactionId'
when the status of a transaction changes.
No
refundAddress string GUQsGwmX4Wh9fiiQ81rHAiMhqafD6K9WHu Refund address. No

JSON Payload example

{
    "pair": "NLG_BTC",
    "amount": "0.001",
    "withdrawal": "13qF4vRgCuAfMj6rcfhKz5RTfd9UiY92Ls",
    "fee": "withdrawal"
}

JSON Response success example

{
    "success":{
        "transactionId":"b56f01f36c5335227440d6b6162f3211",
        "pair":"NLG_BTC",
        "withdrawal":"13qF4vRgCuAfMj6rcfhKz5RTfd9UiY92Ls",
        "withdrawalAmount":0.001,
        "deposit":"GPEZUzMp1iodqyZ26goejS2XK4WURYtY1u",
        "depositAmount":"229.54545455",
        "expiration":"2015-04-24 22:37:06"
    },
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/transaction"
        }
    }
}

JSON Response error example

{
    "error": "Melding",
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/transaction"
        }
    }
}

Transaction status

Check the status of a transaction by 'transactionId'

Method: GET

URL: https://nocks.co/api/transaction/[transactionId]

Name Meaning
pending Awaiting payment
timeout No payment received
cancelled Transaction cancelled
success Transaction completed

JSON Response success example

{
    "success":{
        "status":"pending",
        "transactionId":"b56f01f36c5335227440d6b6162f3211",
        "pair":"NLG_BTC",
        "withdrawal":"13qF4vRgCuAfMj6rcfhKz5RTfd9UiY92Ls",
        "withdrawalAmount":0.001,
        "deposit":"GPEZUzMp1iodqyZ26goejS2XK4WURYtY1u",
        "depositAmount":"229.54545455",
        "expiration":"2015-04-24 22:37:06"
    },
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/transaction\/b56f01f36c5335227440d6b6162f3211"
        }
    }
}

JSON Response error example

{
    "error": "Sorry, this transaction does not exist.",
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/transaction\/b56f01f36c5335227440d6b6162f3211"
        }
    }
}

Cancel transaction

Cancel a transaction by 'transactionId'

Method: UPDATE

URL: https://nocks.co/api/transaction/[transactionId]

JSON Payload example

{
    "status": "cancelled"
}

JSON Response success example

{
    "success":{
        "status":"cancelled",
        "transactionId":"b56f01f36c5335227440d6b6162f3211",
        "pair":"NLG_BTC",
        "withdrawal":"13qF4vRgCuAfMj6rcfhKz5RTfd9UiY92Ls",
        "withdrawalAmount":0.001,
        "deposit":"GPEZUzMp1iodqyZ26goejS2XK4WURYtY1u",
        "depositAmount":"229.54545455",
        "expiration":"2015-04-24 22:37:06"
    },
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/transaction\/b56f01f36c5335227440d6b6162f3211"
        }
    }
}

JSON Response error example

{
    "error": "Sorry, this transaction does not exist.",
    "_links":{
        "self":{
            "href":"http:\/\/nocks.co\/api\/transaction\/b56f01f36c5335227440d6b6162f3211"
        }
    }
}