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 of 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

Creating a transaction.

Method: POST

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

Name Type Example Description Required
pair string NLG_BTC NLG_BTC of BTC_NLG Ja
amount float 0.001 Amount to be send to 'withdrawal' address. Ja
withdrawal string 013qF4vRgCuAfMj6rcfhKz5RTfd9UiY92Ls Receiving address. Ja
fee string withdrawal of deposit Charge fee on 'withdrawal' or 'deposit' address. Nee

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"
        }
    }
}