HodlHodl API Documentation (v1)

Notice: in order to use API you should enable it in your account preferences.

Authorization

Use API key from your account preferences and add the following header to each request:

Authorization: Bearer <your_api_key>

The next endpoints are public and do not require API key:

  • GET /api/v1/countries

  • GET /api/v1/currencies

  • GET /api/v1/offers

  • GET /api/v1/offers/:id

  • GET /api/v1/payment_methods

“Signed request”

If you want to provide release_address in Creating contract request, you have to “sign” the request.

To sign the request:

  • Get current time as Unix timestamp (integer). Convert that number to a string (using the usual decimal representation, e.g. you should get "1596026883" if current time is 2020-07-29 12:48:03 UTC). We’ll refer to that string as nonce.
  • Retrieve Signature Key from the user (which could be obtained at “API Access” tab of “Account settings” section of the website when API access is enabled). If you want to save Signature Key for further usage (i.e. to not request user to enter Signature Key each time it’s required) you should explicitly warn the user that that would allow your service/application to directly access user’s funds. We’ll refer to Signature Key as signature_key.

Then, calculate the following: SHA256-HMAC(key = signature_key, message = "<api_key>:<nonce>"). I.e., calculate HMAC:

  • Using SHA256 as cryptographic hash function
  • Using signature_key as secret key
  • Using the concatenation of the following three strings as message/payload: <api_key> (the user’s “regular” API key, see the very top of this document), : (colon character), <nonce> (as described above in this section)

We’ll call the resultant value of this calculation hmac. Represent/digest hmac as hex string (use digits and lower case only a-f symbols).

Then, add nonce and hmac parameters to the corresponding API request (to the root of the request parameters).

Each nonce you provide must be greater (as a number) than the one provided in the previous signed request. Also, nonce must correspond to a time reasonably close to “the now”.

Notice, that you must not provide signature key as request parameter.

IMPORTANT: “signed request” procedure goal is to enable a user to select desired “trust level” for the service/application which runs API requests on the user’s behalf (by allowing the user to provide only their API key to the service/application, and not their signature key). While using “signed request” it is especially important for a service/application to ensure that direct and proper HTTPS connection with the trading platform’s servers has been established. Signed request is not aimed to reinvent internet security, and shouldn’t be considered as such, thus it fully relies on the underlying HTTPS protocols to ensure safety.

Error handling

The server will respond with JSON with error_code and relevant HTTP status.

The response is a JSON object (hash) with "status" key.

"status" is set to "success" (if the request was fulfilled) or "error" (otherwise).

"error_code" key contains error code (short string) if "status" is "error".

If the requested entity wasn’t found, the following response will be sent with 404 NOT FOUND HTTP status:

{
  "status": "error",
  "error_code": "not_found"
}

If required root parameter of the request is ommitted, the following response will be sent with 400 BAD REQUEST HTTP status:

{
  "status": "error",
  "error_code": "missing_parameter",
  "parameter": "<parameter name here>"
}

If rate limit has been exceeded, the following will be sent with 429 TOO MANY REQUESTS HTTP status:

{
  "status": "error",
  "error_code": "rate_limit_exceeded",
  "message": "rate limit is 2 per 60s"
}

If service is temporarily unavailable, the following response will be sent with 503 SERVICE UNAVAILABLE HTTP status:

{
  "status": "error",
  "error_code": "not_available"
}

(When this reponse is received the request should be repeated later.)

Validation errors

If any validation errors occur when trying to create or update an entity, then the following response will be returned with HTTP status 422:

{
  "status": "error",
  "error": "validation",
  "validation_errors": {
    "<field>": ["<error1>", "<error2>", ...]
  }
}

I.e., "validation_errors" will be returned, which is a hash. Each key of that hash corresponds to the entity’s erroneous field, and the value is an array of human-readable English strings (representing occured validation errors).

Contracts API restrictions

There is no way to create (resolve, work with, etc.) disputes or leave feedback to a counterparty via the API at the moment. Such actions currently should be performed manually via the website.

All contracts operations require payment password to be created via the website (Profile -> Trading Settings). This operation actually creates payment seed on the client (in the browser) and stores encrypted payment seed on the server. Payment seed should be created by offer’s acceptor as well as offer’s creator.

If payment password hasn’t been created on the website, validation error will be returned to “Create contract” request. Currently there is no way to create payment password/encrypted seed via the API for security reasons.

If “Bitcoin address” hasn’t been set in “Trading Settings”, validation error will be returned to “Create contract” request. Currently there is no way to set release address on a per contract basis for security reasons.

Encrypted payment seed could be retrieved via Users/Getting myself method.

Contracts API workflow

  1. Buyer or seller sends “Creating contract” request to the server
  2. Initiator sends “Getting contract” request once every 1-3 minutes until contract.escrow.address is not null (thus, waiting for offer’s creator to confirm their payment password in case they use the website)
  3. Each party verifies the escrow address locally
  4. Each party sends “Confirming contract’s escrow validity” request to the server
  5. Seller deposits cryptocurrency to escrow address
  6. Buyer checks contract status with “Getting contract” request to the server once every 1-5 minutes until contract status is "in_progress"
  7. Buyer verifies locally that correct amount of cryptocurrency has been deposited to escrow address and correct number of blockchain confirmations has been received
  8. Buyer sends fiat payment to the seller
  9. Buyer sends “Marking contract as paid” request to the server
  10. Seller verifies locally that they actually has received fiat payment
  11. Seller fetches pre-signed by the server release transaction with “Showing release transaction of contract” request
  12. Seller verifies and signs the release transaction locally
  13. Seller sends the signed release transaction to the server with “Signing release transaction of contract

If you are the seller, DO NOT SEND BITCOINS UNTIL CONTRACT STATUS IS "depositing".

If you are the buyer, DO NOT SEND PAYMENT UNTIL CONTRACT STATUS IS "in_progress".

Note: both buyer and seller could check contract status (including information on deposited cryptocurrency) at any time with “Getting contract” request.

Client-side operations

The following operations should be performed on the client (as decribed above):

  • seed encryption/decryption
  • escrow validation
  • transaction signing

References

See HodlHodl Multisig contract specification for detailed description of multisig.

See Bitcoin core documentation for detailed description of P2SH(P2WSH) addresses.

Seed encryption/decryption

The terms “seed” and “xpub” are used as defined in BIP32. Recommended seed length is 64 bytes.

To obtain public or private key for a particular contract use derivation path m/i, where i is provided by the server in as contract.escrow.index in Getting contract response.

Seed is encrypted with so called “payment password” which results in “encrypted seed”.

When user creates payment password on the trading platform’s website what actually happens is:

  • browser generates random seed
  • browser encrypts this seed with user-provided payment password
  • browser sends encrypted seed to the server
  • server stores encrypted seed with user data

This workflow allows user to seamlessly change clients without need to export/import their seed (they only need to remember payment password and provide it to the client). Encrypted seed is provided in Getting myself response, clients might save and back up that value for additional safety.

Encrypted seed is a string of the following kind:

ES1:<ciphertext_hex>:<salt_hex>:pbkdf2:10000

ES1 is the version of the algorithm used to encode the string (currently only one version exists), pbkdf2 is the name of key derivation function and 10000 is the number of iterations for PBKDF2. Clients must treat ES1, pbkdf2, 10000 as fixed values and check that encrypted seed satisfies this template.

<ciphertext_hex> is hex-encoded result of AES encryption of the seed.

<salt_hex> is hex-encoded salt, used for several purposes.

To decrypt seed use the following algorithm (pseudocode):

  1. Let payment_password be payment password of the user
  2. Check that encrypted seed satisfies regexp /^ES1:([a-f0-9]+):([a-f0-9]+):pbkdf2:10000$/
  3. Split encrypted seed with ‘:’, extract 2nd element as ciphertext_hex, 3rd element as salt_hex
  4. Let ciphertext be the hex-decoded value of ciphertext_hex, salt be the hex-decoded value of salt_hex
  5. Derive aesKey with PBKDF2-HMAC-SHA256:
    • aesKey = PBKDF2-SHA256(password = payment_password, salt = salt, derived key len = 16 bytes, iterations = 10000)
  6. Derive seed:
    1. Let iv be the first 12 bytes of ciphertext
    2. Let authTag be the last 16 bytes of ciphertext
    3. Let content be all the rest of ciphertext (without first 12 and last 16 bytes)
    4. Perform AES-128-GCM decyption
      • seed = AES-128-GCM-DECRYPT(key = aesKey, iv = iv, auth tag length = 16 bytes, auth tag = authTag, ciphertext = content)
    5. If decryption fails, consider payment_password to be wrong
  7. Verify decrypted seed
    1. Let mac be the first 16 bytes of SHA256-HMAC(key = payment_password, message = seed)
    2. Check that mac equals to salt. If not, consider payment_password to be wrong

Example

Encrypted seed

ES1:7eda9c6f743602a3175d4c522381ab8fb402a75e57cdb3af38aaa0511eac09f28ac45e6f3c368962453de190081f94311fbeab69406e8a36241f0f79bb5d81ee881c73eea3cc488f501cf0030355374f1bba0c16071a773e9e7c1879:8a4acbac1c107faf5652782d5b569a7e:pbkdf2:10000

XPub

xpub661MyMwAqRbcFRUMeZHWy6W9D7MkVbboYehf3RrDPdGFxqfHD3uWBJfMFrrMjTNEddTgYSFktearKrCnoAZV949SSNpakwMGPDeu98DZFiU

Payment password: gg5GvNZAwgWQeVS

aesKey (hex): de9bccdb2a8d14136967bc3286f0ce6a

Decrypted seed (hex)

646131227d65c6d729bc82ddc9e4d141ab69b1ee0dc840cf07183fc8b6f7faeb9ba2d9f0ad357102c578a74700c4491349cd4002991a1c4e8d41accc538d27cc

Derived private key for index 10164 (hex)

4aca31a8e38da930d260253b8c02191abf4bf40bce355712522ac369229b7ea5

Escrow validation

Client must validate witness script and escrow address using information from Getting contract request. Witness script in the response is hex-encoded.

Witness script (contract.escrow.witness_script)

  • Must follow 2-of-3 P2SH(P2WSH) multisig template
  • Must contain correct client’s public key as one of 3 public keys (derived from the client’s seed using contract.escrow.index as derivation index)

Escrow address (contract.escrow.address)

  • Must be 2-of-3 P2SH(P2WSH) multisig address
  • Must use the same three pubkeys which are used in the witness script

Notes

It is recommended to use well-tested libraries to check escrow address.

The following regexp could be used to check witness script hex string and extract public keys:

// javascript example

const twoOfThreeWitness = /^5221([a-f0-9]{66})21([a-f0-9]{66})21([a-f0-9]{66})53ae$/

const script = "522103327a0c6b641047a0a1579fe524c585bbfa79a5eb72c369e4a76f8fb31dbd69ee2102f2f4b089dcfbdf5e129c7747f4a63bfa0c503c0eaf391140998bcd7abafafeab210276f96783752ec81e2afee2b2b24f225ff04174b3d9da220c4b8a2c7a71f8689453ae"

const [_, hodlPubKey, sellerPubKey, buyerPubKey] = script.match(twoOfThreeWitness)

The following code could be used with bitcoinjs-lib to check address:

// javascript - example continues from the previous block of code

import * as bitcoin from 'bitcoinjs-lib'
import {Buffer} from 'buffer'

const correctAddress = bitcoin.payments.p2sh({
  redeem: bitcoin.payments.p2wsh({
    redeem: bitcoin.payments.p2ms({
      m: 2,
      pubkeys: [hodlPubKey, sellerPubKey, buyerPubKey].map((x) => Buffer.from(x, 'hex')),
      network: bitcoin.networks.bitcoin // or bitcoin.networks.testnet for testnet
    })
  })
}).address

// compare correctAddress with contract.escrow.address

Transaction signing

Server will return hex-encoded partially-signed transaction (i.e. instead of the user’s signature there would be several 0 symbols) with Showing release transaction of contract or Showing refund transaction of contract methods.

Using HodlHodl Multisig contract specification for reference validate that:

  • Transaction inputs are from escrow address
  • Transaction outputs contain user’s release (or refund, if this is a refund transaction) address
  • User address receives valid amount of funds (escrow amount minus applicable network and service fees)

Then sign the transaction (add user’s signature instead of 0s in the corresponding place) and post it to the server with Signing release transaction of contract or Signing refund transaction of contract request.

Contract fees breakdown

See Terms of Service for full explanation on how fees work. Below is non-binding explanation for fields seen in API responses (several Contracts and Offers methods) and how they correspond to the websites’ fields.

- Website text API field name Meaning
1 How much do you want to buy/sell? (Entered in BTC) Amount of BTC a buyer will receive/seller will give
2 How much do you want to buy/sell? (Entered in fiat currency) contract.value Amount of fiat a buyer will pay/seller will receive
3 To be deposited (BTC) contract.volume Amount of BTC a seller should pay (blockchain fee paid on top of that)
4 Goes to the buyer (BTC) contract.volume_breakdown.goes_to_buyer Amount of BTC a buyer will receive (blockchain fee paid from that)
5 Trading fee (BTC) contract.volume_breakdown.exchange_fee Amount of BTC trading platform receives (blockchain fee not applicable)
6 Fiat trading fee deduction (fiat) contract.volume_breakdown.exchange_fee_in_fiat Half of amount from previous row (#5) converted to fiat (fiat equivalent of buyer’s part of trading fee)
7 Transaction fee (estimated) (BTC) contract.volume_breakdown.transaction_fee, offer.fee.transaction_fee Estimated blockchain fee which a buyer will pay (#4)
8 Current trading fee: XX% (percent/fraction) offer.fee.author_fee_rate, offer.fee.your_fee_rate Percent (website) or the same as fraction (API) of trading fee set for particular user. Minimum among “your” (current user) and “author” (offer creator) fee rate (#9) is multiplied by contract volume (#3) and results in trading fee (#5).
9 offer.fee.exchange_fee Minimum among “your” and “author” (#8) trading fee

Backward-incompatible changes

Earlier there was filters.volume field in GET /api/v1/offers and GET /api/v1/offers/fetch_new, now it is replaced with filters.amount field (see endpoints’ description for futher details).

Chat messages

Chat messages resource

Listing chat messages for a contract

Endpoint

GET /api/v1/contracts/:contract_id/chat_messages

Parameters

Name Description
contract_id

Contract ID

Request

Route

GET /api/v1/contracts/SJVR0JVgTMZl1hhq/chat_messages

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/contracts/SJVR0JVgTMZl1hhq/chat_messages" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
chat_messages

Chat messages array

chat_messages[#].text

Text

chat_messages[#].author

Login of author

chat_messages[#].from_admin

Author is a trading platform’s admin? (true or false)

chat_messages[#].sent_at

Sent datetime in UTC, ISO8601 (YYYY-MM-DDThh:mm:ssZ)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "chat_messages": [
    {
      "text": "Hi!",
      "author": "test_user",
      "from_admin": false,
      "sent_at": "2024-08-29T23:13:28.300298Z"
    },
    {
      "text": "Hi to you!",
      "author": "us4r51",
      "from_admin": false,
      "sent_at": "2024-08-29T23:13:28.332587Z"
    }
  ]
}

Contracts

Contracts resource

Getting contract

This method could be requested at any time by either party to check contract status (including status of cryptocurrency deposit).

Endpoint

GET /api/v1/contracts/:id

Parameters

Name Description
id

Contract ID

Request

Route

GET /api/v1/contracts/VSbPi0DTmqR5cz9m

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/contracts/VSbPi0DTmqR5cz9m" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract resource

contract.id

ID

contract.your_role

Your role ("buyer" or "seller")

contract.can_be_canceled

Can be canceled in its current state by you? (true or false)

contract.offer_id

Offer ID

contract.value

Value (i.e. fiat price of contract)

contract.price

Asset price (in currency_code fiat currency, at the moment of the creation of the contract)

contract.currency_code

Currency/asset code of ‘value’ field (e.g. ‘USD’)

contract.volume

Volume (i.e. BTC price of contract)

contract.asset_code

Asset code of ‘volume’ field (‘BTC’)

contract.comment

Comment of the Contract’s initiator

contract.release_address

Release address (only shows in Getting contract method for buyer)

contract.confirmations

Blockchain confirmations required for deposit transaction in order for Contract to be considered 'Deposited'

contract.payment_window_minutes

Payment window set by the offer author for the contract, during which the buyer must transfer the payment using the agreed upon payment method.

contract.depositing_window_minutes

Depositing window set by the exchange during which the seller must deposit bitcoins into escrow

contract.payment_window_time_left_seconds

Payment window time left (in seconds)

contract.payment_window_seconds_left

Payment window time left (in seconds, alias to payment_window_time_left_seconds, which is now deprecated)

contract.depositing_window_time_left_seconds

Depositing window time left (in seconds)

contract.country_code

Country code (or "Global")

contract.current_user_has_unreleased_funds

Current user has unreleased multisig deposits

contract.status

Contract status. There are the following statuses:

  • 'pending' — awaiting confirmation from buyer and/or seller (initial status)
  • 'depositing' — awaiting deposition from seller and confirmations from the blockchain
  • 'in_progress' — deposition has been confirmed by the blockchain
  • 'paid' — buyer has confirmed they sent the payment
  • 'completed' — cryptocurrency has been released/transfered from the escrow (final status)
  • 'canceled' — contract has been canceled (final status)
  • 'disputed' — contract is disputed
  • 'resolved' — dispute has been resolved by admin (final status; voluntary resolution instead leads to 'completed' status)

If you are the seller, DO NOT SEND BITCOINS UNTIL CONTRACT STATUS IS 'depositing'.

If you are the buyer, DO NOT SEND PAYMENT UNTIL CONTRACT STATUS IS 'in_progress'.

contract.dispute_status

Contract dispute status. null unless contract status is 'resolved'.

contract.country

Country name (or 'Global')

contract.country_code

Country code (or 'Global')

contract.created_at

Creation datetime in UTC, ISO8601 (YYYY-MM-DDThh:mm:ssZ)

contract.counterparty

Counterparty information

contract.counterparty.login

Login

contract.counterparty.online_status

'online', 'recently_online' or 'offline'

contract.counterparty.rating

Rating (as fraction of 1)

contract.counterparty.trades_count

Number of conducted trades

contract.counterparty.url

Hodlhodl website URL

contract.counterparty.verified

Verified? (true or false)

contract.counterparty.verified_by

Login of the Strong Hodler who verified this user

contract.counterparty.strong_hodler

Strong Hodler? (true or false)

Strong Hodler is a member of Hodl Hodl volunteer team that we’re working directly with.

contract.counterparty.country

Country name (or 'Global')

contract.counterparty.country_code

Country code (or 'Global')

contract.counterparty.average_payment_time_minutes

Average payment time (in minutes)

contract.counterparty.average_release_time_minutes

Average release time (in minutes)

contract.counterparty.days_since_last_trade

Number of days since last trade

contract.counterparty.blocked_by

How many traders blocked this user

Payment method instruction fields

contract.payment_method_instruction.payment_method_name

Name of payment method

contract.payment_method_instruction.payment_method_id

ID of payment method

contract.payment_method_instruction.details

Text of the instruction

Volume breakdown

contract.volume_breakdown.goes_to_buyer

Buyer receives this amount minus transaction fee

contract.volume_breakdown.exchange_fee

Amount of crypto currency that trading platform receives

contract.volume_breakdown.exchange_fee_in_fiat

Fiat equivalent of exchange fee (in currency_code currency)

contract.volume_breakdown.transaction_fee

Estimated blockchain transaction fee

Escrow information

contract.escrow.address

Escrow BTC address (for verification)

This field might be null if the offer’s creator uses the website and hasn’t yet confirmed one’s payment password. In such case, repeat this request once every 1-3 minutes until escrow address appears.

contract.escrow.witness_script

Escrow redeem witness script (for verification)

contract.escrow.index

Escrow xpub/xpriv index (for verification)

contract.escrow.you_confirmed

Have you verified and confirmed the escrow? (true or false)

contract.escrow.counterparty_confirmed

Have the other party verified and confirmed the escrow? (true or false)

contract.escrow.confirmations

Blockchain confirmations received so far

contract.escrow.amount_deposited

Amount deposited (in BTC; null when no deposit has been made yet)

contract.escrow.amount_released

Amount released (in BTC; null when no release has been made yet)

contract.escrow.deposit_transaction_id

Blockchain ID of deposit transaction (null when no deposit has been made yet)

contract.escrow.release_transaction_id

Blockchain ID of release transaction (null when no release has been made yet)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "VSbPi0DTmqR5cz9m",
    "your_role": "seller",
    "can_be_canceled": true,
    "offer_id": "ccvBAfeNDzoORJP9",
    "price": "700.00",
    "value": "7904.55",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": false,
    "confirmations": 2,
    "payment_window_seconds_left": null,
    "payment_window_time_left_seconds": null,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "pending",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9384",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "76.24",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.00",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 84",
    "country_code": "Country Code 84",
    "created_at": "2024-08-29T23:13:28.572424Z",
    "counterparty": {
      "login": "us4r52",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://localhost:3000/users/us4r52",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 83",
      "country_code": "Country Code 83",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "escrow": {
      "address": "address_21",
      "witness_script": null,
      "index": 1563,
      "you_confirmed": false,
      "counterparty_confirmed": false,
      "confirmations": 0,
      "amount_deposited": "0.00000000",
      "amount_released": null,
      "deposit_transaction_id": null,
      "release_transaction_id": null
    }
  }
}

Listing my contracts

This method will return all your existing contracts, recently created first.

Response could be filtered by side and/or by status.

Endpoint

GET /api/v1/contracts/my

Parameters

Name Description
pagination.limit

Number of records to return (default 50, maximum 100)

pagination.offset

Number of records to skip (e.g. 50 for second page of results with the default limit)

filters.side

'buy' or 'sell'

filters.status

Status, see contract.status response field in Getting contract

filters.offer_id

Contracts for offer with id

filters.user_login

Counterparty login

filters.currency_code

Currency/asset code of “value” field (e.g. “USD”)

Request

Route

GET /api/v1/contracts/my?filters[status]=pending

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Query Parameters as JSON

{
  "filters": {
    "status": "pending"
  }
}

cURL

curl -g "hodlhodl.com/api/v1/contracts/my?filters[status]=pending" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contracts

Array of Contracts (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "filters": {
    "status": [
      "pending"
    ]
  },
  "pagination": {
    "limit": 50,
    "offset": 0,
    "total": 3
  },
  "contracts": [
    {
      "id": "ZEaqH1sTrPMLeomF",
      "your_role": "seller",
      "can_be_canceled": true,
      "offer_id": "waNUoXlrZkWXd7pP",
      "price": "725.53",
      "value": "7901.77",
      "currency_code": "USD",
      "volume": "10.89108911",
      "asset_code": "BTC",
      "comment": "Sell me bitcoins, I agree to the terms!",
      "current_user_has_unreleased_funds": false,
      "confirmations": 1,
      "payment_window_seconds_left": null,
      "payment_window_time_left_seconds": null,
      "payment_window_minutes": 60,
      "depositing_window_minutes": 30,
      "depositing_window_time_left_seconds": null,
      "status": "pending",
      "dispute_status": null,
      "payment_method_instruction": {
        "payment_method_id": "9389",
        "payment_method_name": "Yandex Money 54",
        "details": "Send money over to account 123"
      },
      "volume_breakdown": {
        "volume_with_fee": "11.00000000",
        "goes_to_buyer": "10.78217822",
        "exchange_fee": "0.10891089",
        "exchange_fee_in_fiat": "79.02",
        "exchange_fee_percent": "1.0",
        "transaction_fee": "0.00000370",
        "transaction_fee_in_fiat": "0.00",
        "intermediary_fee": "0.00000000",
        "intermediary_fee_in_fiat": "0.00",
        "intermediary_fee_percent": 0.0
      },
      "country": "Country 87",
      "country_code": "Country Code 87",
      "created_at": "2024-08-27T23:13:29.045071Z",
      "counterparty": {
        "login": "us4r56",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": null,
        "my_review": null,
        "trades_count": 0,
        "url": "http://localhost:3000/users/us4r56",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 85",
        "country_code": "Country Code 85",
        "average_payment_time_minutes": null,
        "average_release_time_minutes": null,
        "days_since_last_trade": null,
        "blocked_by": 0
      },
      "escrow": {
        "address": "address_24",
        "witness_script": null,
        "index": 1566,
        "you_confirmed": false,
        "counterparty_confirmed": false,
        "confirmations": 0,
        "amount_deposited": "0.00000000",
        "amount_released": null,
        "deposit_transaction_id": null,
        "release_transaction_id": null
      }
    },
    {
      "id": "PcH89HcCOU9OPh1B",
      "your_role": "buyer",
      "can_be_canceled": true,
      "offer_id": "f2pFcbbrB3j82AXl",
      "price": "725.53",
      "value": "7901.77",
      "currency_code": "USD",
      "volume": "10.89108911",
      "asset_code": "BTC",
      "comment": "Sell me bitcoins, I agree to the terms!",
      "current_user_has_unreleased_funds": false,
      "release_address": "n45ssNV2o1ursURPhLvF1AXVtzrcvKrpPZ",
      "confirmations": 1,
      "payment_window_seconds_left": null,
      "payment_window_time_left_seconds": null,
      "payment_window_minutes": 60,
      "depositing_window_minutes": 30,
      "depositing_window_time_left_seconds": null,
      "status": "pending",
      "dispute_status": null,
      "payment_method_instruction": {
        "payment_method_id": "9387",
        "payment_method_name": "Yandex Money 52",
        "details": "Send money over to account 123"
      },
      "volume_breakdown": {
        "volume_with_fee": "11.00000000",
        "goes_to_buyer": "10.78217822",
        "exchange_fee": "0.10891089",
        "exchange_fee_in_fiat": "79.02",
        "exchange_fee_percent": "1.0",
        "transaction_fee": "0.00000370",
        "transaction_fee_in_fiat": "0.00",
        "intermediary_fee": "0.00000000",
        "intermediary_fee_in_fiat": "0.00",
        "intermediary_fee_percent": 0.0
      },
      "country": "Country 86",
      "country_code": "Country Code 86",
      "created_at": "2024-08-28T23:13:28.913297Z",
      "counterparty": {
        "login": "us4r53",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": null,
        "my_review": null,
        "trades_count": 0,
        "url": "http://localhost:3000/users/us4r53",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 85",
        "country_code": "Country Code 85",
        "average_payment_time_minutes": null,
        "average_release_time_minutes": null,
        "days_since_last_trade": null,
        "blocked_by": 0
      },
      "escrow": {
        "address": "address_23",
        "witness_script": null,
        "index": 1565,
        "you_confirmed": false,
        "counterparty_confirmed": false,
        "confirmations": 0,
        "amount_deposited": "0.00000000",
        "amount_released": null,
        "deposit_transaction_id": null,
        "release_transaction_id": null
      }
    },
    {
      "id": "pWkZcf8RPo3vPzlH",
      "your_role": "buyer",
      "can_be_canceled": true,
      "offer_id": "f2pFcbbrB3j82AXl",
      "price": "725.53",
      "value": "7901.77",
      "currency_code": "USD",
      "volume": "10.89108911",
      "asset_code": "BTC",
      "comment": "Sell me bitcoins, I agree to the terms!",
      "current_user_has_unreleased_funds": false,
      "release_address": "n45ssNV2o1ursURPhLvF1AXVtzrcvKrpPZ",
      "confirmations": 1,
      "payment_window_seconds_left": null,
      "payment_window_time_left_seconds": null,
      "payment_window_minutes": 60,
      "depositing_window_minutes": 30,
      "depositing_window_time_left_seconds": null,
      "status": "pending",
      "dispute_status": null,
      "payment_method_instruction": {
        "payment_method_id": "9386",
        "payment_method_name": "Yandex Money 51",
        "details": "Send money over to account 123"
      },
      "volume_breakdown": {
        "volume_with_fee": "11.00000000",
        "goes_to_buyer": "10.78217822",
        "exchange_fee": "0.10891089",
        "exchange_fee_in_fiat": "79.02",
        "exchange_fee_percent": "1.0",
        "transaction_fee": "0.00000370",
        "transaction_fee_in_fiat": "0.00",
        "intermediary_fee": "0.00000000",
        "intermediary_fee_in_fiat": "0.00",
        "intermediary_fee_percent": 0.0
      },
      "country": "Country 86",
      "country_code": "Country Code 86",
      "created_at": "2024-08-24T23:13:28.848828Z",
      "counterparty": {
        "login": "us4r53",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": null,
        "my_review": null,
        "trades_count": 0,
        "url": "http://localhost:3000/users/us4r53",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 85",
        "country_code": "Country Code 85",
        "average_payment_time_minutes": null,
        "average_release_time_minutes": null,
        "days_since_last_trade": null,
        "blocked_by": 0
      },
      "escrow": {
        "address": "address_22",
        "witness_script": null,
        "index": 1564,
        "you_confirmed": false,
        "counterparty_confirmed": false,
        "confirmations": 0,
        "amount_deposited": "0.00000000",
        "amount_released": null,
        "deposit_transaction_id": null,
        "release_transaction_id": null
      }
    }
  ]
}

Creating contract

Note 1. offer_version and payment_method_instruction_version could be obtained by querying Getting offer. Clients should not interpret this value. This value will change every time the corresponding offer or payment method instruction is changed. Requiring to provide these values on contract creation ensures that the end-user agrees to the exact terms of offer which they have seen.

Note 2. To create contract for ‘buy’ offer, payment_method_instruction_id should be ID of one of your payment method instructions (see Payment method instructions resource). payment_method_id of the given payment method instruction should be one of the payment_method_ids of the offer.

To create contract for ‘sell’ offer, payment_method_instruction_id should be ID of one of the offer’s payment_method_instructions.id (see Getting offer).

Note 3. Either value or volume must be present in the request (but not both). Non-present value will be calculated automatically (using offer’s price of the created contract).

Note 4. When volume is provided by buyer, actual contract volume is increased to account for trading platform’s fee.

Note 5. See Signed request.

Endpoint

POST /api/v1/contracts

Parameters

Name Description
contract.offer_id

Offer ID (required)

contract.offer_version

Offer version 1 (required)

contract.payment_method_instruction_id

Payment method instruction ID (required) 2

contract.payment_method_instruction_version

Payment method instruction version 1 (required)

contract.comment

Comment of the Contract’s initiator

Value/volume fields 3 (exactly 1 of the following is required):

contract.value

Value (i.e. fiat price of contract; will be rounded to 2 decimal digits)

contract.volume

Volume (i.e. BTC price of contract) 4

Release address (signed request; provide all or none of the following):

contract.release_address

Release address (if omitted then default one from the user’s settings will be used)

nonce

Nonce (string) 5

hmac

Result of HMAC-SHA256 calculation 5

Request

Route

POST /api/v1/contracts

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "contract": {
    "offer_id": "whFLfrVSzpWbw6nB",
    "offer_version": "6f96sg",
    "payment_method_instruction_id": 8370,
    "payment_method_instruction_version": "6jw41s",
    "comment": "I accept your offer",
    "value": 50
  }
}

cURL

curl "hodlhodl.com/api/v1/contracts" -d '{"contract":{"offer_id":"whFLfrVSzpWbw6nB","offer_version":"6f96sg","payment_method_instruction_id":8370,"payment_method_instruction_version":"6jw41s","comment":"I accept your offer","value":50}}' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "6lOZCCBRJH2pKv14",
    "your_role": "buyer",
    "can_be_canceled": true,
    "offer_id": "whFLfrVSzpWbw6nB",
    "price": "40000.00",
    "value": "50.00",
    "currency_code": "EUR",
    "volume": "0.00125000",
    "asset_code": "BTC",
    "comment": "I accept your offer",
    "current_user_has_unreleased_funds": false,
    "release_address": "n45ssNV2o1ursURPhLvF1AXVtzrcvKrpPZ",
    "confirmations": 2,
    "payment_window_seconds_left": null,
    "payment_window_time_left_seconds": null,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "pending",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9390",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "0.00126250",
      "goes_to_buyer": "0.00123750",
      "exchange_fee": "0.00001250",
      "exchange_fee_in_fiat": "0.50",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.15",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 89",
    "country_code": "Country Code 89",
    "created_at": "2024-08-29T23:13:29.470985Z",
    "counterparty": {
      "login": "us4r58",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://localhost:3000/users/us4r58",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 88",
      "country_code": "Country Code 88",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "escrow": {
      "address": "2NFihTnadLx83TTvsR3SXdMXCiRnuac2BBD",
      "witness_script": "522102cea4ec166d18b2566851da490c64034e8c903cc16e0c0cf5a9804d2219f40607210301aa407b6eb46b43bc621a29b914cc7a73924ad0289d89f8d6c0d3d31e884b5e210301aa407b6eb46b43bc621a29b914cc7a73924ad0289d89f8d6c0d3d31e884b5e53ae",
      "index": 1567,
      "you_confirmed": false,
      "counterparty_confirmed": false,
      "confirmations": 0,
      "amount_deposited": "0.00000000",
      "amount_released": null,
      "deposit_transaction_id": null,
      "release_transaction_id": null
    }
  }
}

Verifying signature key

This method should be used to verify signature key (together with API key)

Endpoint

POST /api/v1/contracts/verify_signature_key

Parameters

Name Description
nonce

Nonce (string) (see Signed request)

hmac

Result of HMAC-SHA256 calculation (see Signed request)

Request

Route

POST /api/v1/contracts/verify_signature_key

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "nonce": "1657892498",
  "hmac": "d9629c165455dcde0518132280daa9416b2d998bf468ebf1ea637f0bc03ebe77"
}

cURL

curl "hodlhodl.com/api/v1/contracts/verify_signature_key" -d '{"nonce":"1657892498","hmac":"d9629c165455dcde0518132280daa9416b2d998bf468ebf1ea637f0bc03ebe77"}' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success"
}

Confirming contract's escrow validity

This method is used to confirm that client-side validation of escrow data was successful.

This method should be called immediately after escrow address appeared in Getting contract response and this escrow address has been verified locally by the client.

Client should verify contract’s escrow data (witness script, address and index) and then send this request. See JS client documentation/examples for more details.

This method gives information to the server that the calling party agrees to go forward with the contract. Clients should ensure by themselves independently that they move funds to the correct address/escrow.

Endpoint

POST /api/v1/contracts/:id/confirm

Parameters

Name Description
id

Contract ID

Request

Route

POST /api/v1/contracts/dVFxgBR77jTOrgEU/confirm

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/contracts/dVFxgBR77jTOrgEU/confirm" -d '' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "dVFxgBR77jTOrgEU",
    "your_role": "buyer",
    "can_be_canceled": true,
    "offer_id": "nOZFKAsIENqEXvMH",
    "price": "7000.00",
    "value": "7218.41",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": false,
    "release_address": "n45ssNV2o1ursURPhLvF1AXVtzrcvKrpPZ",
    "confirmations": 2,
    "payment_window_seconds_left": null,
    "payment_window_time_left_seconds": null,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "pending",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9391",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "762.38",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.03",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 92",
    "country_code": "Country Code 92",
    "created_at": "2024-08-29T23:13:29.904275Z",
    "counterparty": {
      "login": "us4r59",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://localhost:3000/users/us4r59",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 91",
      "country_code": "Country Code 91",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "escrow": {
      "address": "address_25",
      "witness_script": null,
      "index": 1568,
      "you_confirmed": true,
      "counterparty_confirmed": false,
      "confirmations": 0,
      "amount_deposited": "0.00000000",
      "amount_released": null,
      "deposit_transaction_id": null,
      "release_transaction_id": null
    }
  }
}

Marking contract as paid

Buyer (and only buyer) should call this method when fiat payment was made.

This method could be called only if contract’s status is 'in_progress'.

Endpoint

POST /api/v1/contracts/:id/mark_as_paid

Parameters

Name Description
id

Contract ID

Request

Route

POST /api/v1/contracts/oiDafreDY5P1rNsC/mark_as_paid

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/contracts/oiDafreDY5P1rNsC/mark_as_paid" -d '' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "oiDafreDY5P1rNsC",
    "your_role": "buyer",
    "can_be_canceled": false,
    "offer_id": "TGlNoAqniwF6DaQZ",
    "price": "700.00",
    "value": "7904.55",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": true,
    "release_address": "n45ssNV2o1ursURPhLvF1AXVtzrcvKrpPZ",
    "confirmations": 2,
    "payment_window_seconds_left": 3599854000,
    "payment_window_time_left_seconds": 3599854000,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "paid",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9392",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "76.24",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.00",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 94",
    "country_code": "Country Code 94",
    "created_at": "2024-08-29T23:13:30.236126Z",
    "counterparty": {
      "login": "us4r60",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://localhost:3000/users/us4r60",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 93",
      "country_code": "Country Code 93",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "escrow": {
      "address": "2N6ExX2TJRmY6y7KYT9VwPPggCZWMbceVkD",
      "witness_script": "522102549a5a9f05c7e117350d5960c6c34619c7c069f27b3b6e1d4ed394288212c72c2102e56c68578c14b3a61d2ecbecc0dcc2b024a99c12fb491c3bc52eb299ad1aacd52102e56c68578c14b3a61d2ecbecc0dcc2b024a99c12fb491c3bc52eb299ad1aacd553ae",
      "index": 1569,
      "you_confirmed": true,
      "counterparty_confirmed": true,
      "confirmations": 1,
      "amount_deposited": "11.00000000",
      "amount_released": null,
      "deposit_transaction_id": "txid_13",
      "release_transaction_id": null
    }
  }
}

Canceling contract

Contract could be canceled when any of the following conditions are met:

  • Contract status is 'pending' and there are no bitcoins at the escrow address according to our most recent data
  • Contract status is 'depositing' and you are the seller
  • Contract status is 'depositing', you are the buyer, and depositing time has expired
  • Contract status is 'in_progress' and you are the buyer
  • Contract status is 'in_progress', you are the seller, and payment window has expired

If none of the conditions above are met then a validation error will be returned:

{
  'status': 'error',
  'error_code': 'validation',
  'validation_errors': {
    'id': ['Contract in its current state can't be cancelled by you']
  }
}

Endpoint

POST /api/v1/contracts/:id/cancel

Parameters

Name Description
id

Contract ID

Request

Route

POST /api/v1/contracts/1yK6maQGsFQsPoqg/cancel

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/contracts/1yK6maQGsFQsPoqg/cancel" -d '' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "1yK6maQGsFQsPoqg",
    "your_role": "buyer",
    "can_be_canceled": false,
    "offer_id": "0ymyG08uGlwqVAVT",
    "price": "700.00",
    "value": "7904.55",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": false,
    "release_address": "n45ssNV2o1ursURPhLvF1AXVtzrcvKrpPZ",
    "confirmations": 2,
    "payment_window_seconds_left": null,
    "payment_window_time_left_seconds": null,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "canceled",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9393",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "76.24",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.00",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 96",
    "country_code": "Country Code 96",
    "created_at": "2024-08-29T23:13:30.607974Z",
    "counterparty": {
      "login": "us4r61",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://localhost:3000/users/us4r61",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 95",
      "country_code": "Country Code 95",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "escrow": {
      "address": "address_27",
      "witness_script": null,
      "index": 1570,
      "you_confirmed": false,
      "counterparty_confirmed": false,
      "confirmations": 0,
      "amount_deposited": "0.00000000",
      "amount_released": null,
      "deposit_transaction_id": null,
      "release_transaction_id": null
    }
  }
}

Showing release transaction of contract

This method should be called by seller when contract status is 'paid'; or by buyer when contract status is 'resolved' and 'dispute_status' is 'resolved_in_favor_of_buyer'.

Endpoint

GET /api/v1/contracts/:id/release_transaction

Parameters

Name Description
id

Contract ID

Request

Route

GET /api/v1/contracts/YxIaW36ne4J2WtY5/release_transaction

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/contracts/YxIaW36ne4J2WtY5/release_transaction" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
transaction.contract_id

Contract ID

transaction.hex

Hex string which represents transaction to be signed

transaction.in_amounts

tx_in amounts of the transaction (Array of Integers)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "transaction": {
    "contract_id": "YxIaW36ne4J2WtY5",
    "hex": "01000000000101931f8e609e3e5a15d6c4965f5cbbb29c32a6f2e9e49e5f0194fc41cf8fdd441c0000000023220020845c778dd8994290551d728dc463e1047a6247a95a9dd03c6dcce94404805bd1ffffffff02704b4440000000001976a914f78cccb98956d9412ec023e18329d98e134c3fa888aca25e4c01000000001600149a4930b4ce7289c899053fa4a6d11a37ef4c919a0400483045022100b9fd40ea6b565b6c4865eebef80849c1bfeb1eb23e4d60d12baee5091e20086e022078410467417fe89921cf8e0bf1b6f947274811714bc178a2c0f718a87c4b1d3c0146000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006952210279b7fdde4b3e24790647e6069c316c41c6d000fc0f2835a265222339e9efbbbf21037fc1fa6cfa497e46779da1953dcda9354c5016596a946a64a6b372d972fe232421037fc1fa6cfa497e46779da1953dcda9354c5016596a946a64a6b372d972fe232453ae00000000",
    "in_amounts": [
      1100000000.0
    ]
  }
}

Showing refund transaction of contract

This method should be called by seller when contract status is 'canceled'; or status is 'resolved' and 'dispute_status' is 'resolved_in_favor_of_seller'.

Endpoint

GET /api/v1/contracts/:id/refund_transaction

Parameters

Name Description
id

Contract ID

Request

Route

GET /api/v1/contracts/lyigCCpFWwaWSJ9R/refund_transaction

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/contracts/lyigCCpFWwaWSJ9R/refund_transaction" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
transaction.contract_id

Contract ID

transaction.hex

Hex string which represents transaction to be signed

transaction.in_amounts

tx_in amounts of the transaction (Array of Integers)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "transaction": {
    "contract_id": "lyigCCpFWwaWSJ9R",
    "hex": "01000000000101931f8e609e3e5a15d6c4965f5cbbb29c32a6f2e9e49e5f0194fc41cf8fdd441c000000002322002082cd2418dbb4cac2e4e697fb88920ebe30e5e77783fca599fbd09ceb28d52d6affffffff0134aa9041000000001976a914fbff95b4e35aca918d26e157392ea1643a2dc28388ac040047304402200463b33f0253a011d1ca951a1799107e6e7baa1d63677c09e9797c5239c492d30220130b00cd29000b0a9bff501f362bc75a71b1d6386e87a6a48d76a506855b7d5b01460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000069522103162436abe93401c644d58aea1595a98f6c52cbdfd825a742e75bf618a87ba60b2102c0b746bce799677d7d6f257f4cf4c66afc5f2fd0b25473487e9f69a967604ca42102c0b746bce799677d7d6f257f4cf4c66afc5f2fd0b25473487e9f69a967604ca453ae00000000",
    "in_amounts": [
      1100000000.0
    ]
  }
}

Signing release transaction of contract

This method seller should call after viewing & verifying release transaction. Provide signed transaction as hex string in the 'hex' parameter.

Endpoint

POST /api/v1/contracts/:id/release_transaction

Parameters

Name Description
id

Contract ID

hex

Hex string which represents signed transaction

Request

Route

POST /api/v1/contracts/brot37F35Pf6tRI4/release_transaction

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "hex": "01000000000101678a8e2c7f513b26dff0d8ce8cfc4502f881c227ee04a3303269ac3cf470698c0000000023220020c5dd11c968cf13500f9cf8fcb2e851dd0bb7ea80a1382d639e9eedffa93806f8ffffffff02cca30200000000001976a914ac288fdff4b0bce5a92c3a36b521f05ec8b04fe788ac16040000000000001600149c8653aa0f661dec64a4cd2dc7f7a817a69cfa270400483045022100e73f9e47c251d199eec3623572403794f10648784251aaf4363825cf9d19511c02202c77e36a22b1c6bdaf1f5addb85397af22b60d5382769d7402e07d638832040101483045022100dfd0582dd26edc54348063e597730eadaa96862489d2e2321881bc638aaaab5102201d4e4488a1ca7456aca02838ed29c33f9db67dfac3b3e5c3e685d72556ac83c5016952210259acf58df1360fa96556d1aa00e8bb928d790557e666cd90b3ef8a0dae1b5c702102dc8a3d88e82e9f6d22d6f76d47c6f5c41aed53cfb926bfdbafae25852d3b540621032756f513a93f1443105eef0c11b2164b8c7995d07152331191e536df9232ed1653ae00000000"
}

cURL

curl "hodlhodl.com/api/v1/contracts/brot37F35Pf6tRI4/release_transaction" -d '{"hex":"01000000000101678a8e2c7f513b26dff0d8ce8cfc4502f881c227ee04a3303269ac3cf470698c0000000023220020c5dd11c968cf13500f9cf8fcb2e851dd0bb7ea80a1382d639e9eedffa93806f8ffffffff02cca30200000000001976a914ac288fdff4b0bce5a92c3a36b521f05ec8b04fe788ac16040000000000001600149c8653aa0f661dec64a4cd2dc7f7a817a69cfa270400483045022100e73f9e47c251d199eec3623572403794f10648784251aaf4363825cf9d19511c02202c77e36a22b1c6bdaf1f5addb85397af22b60d5382769d7402e07d638832040101483045022100dfd0582dd26edc54348063e597730eadaa96862489d2e2321881bc638aaaab5102201d4e4488a1ca7456aca02838ed29c33f9db67dfac3b3e5c3e685d72556ac83c5016952210259acf58df1360fa96556d1aa00e8bb928d790557e666cd90b3ef8a0dae1b5c702102dc8a3d88e82e9f6d22d6f76d47c6f5c41aed53cfb926bfdbafae25852d3b540621032756f513a93f1443105eef0c11b2164b8c7995d07152331191e536df9232ed1653ae00000000"}' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "brot37F35Pf6tRI4",
    "your_role": "seller",
    "can_be_canceled": false,
    "offer_id": "zAuV7H9wi5ghHhxr",
    "price": "7000.00",
    "value": "7218.41",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": false,
    "confirmations": 2,
    "payment_window_seconds_left": 3599540000,
    "payment_window_time_left_seconds": 3599539000,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "completed",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9398",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "762.38",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.03",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 102",
    "country_code": "Country Code 102",
    "created_at": "2024-08-29T23:13:32.355631Z",
    "counterparty": {
      "login": "us4r66",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 1,
      "url": "http://localhost:3000/users/us4r66",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 101",
      "country_code": "Country Code 101",
      "average_payment_time_minutes": 0,
      "average_release_time_minutes": null,
      "days_since_last_trade": 0,
      "blocked_by": 0
    },
    "escrow": {
      "address": "2ND6XM397RXcvok4tU3eQdiXWntvm2u8Gm5",
      "witness_script": "522103912741cef195698acea1cb3602b160028c566cb0efb6f9bbcfe731972abe07ef210246b74427b3d9fe7b5f9dc5dca5a673452d796e5ef1f6fe14e5ebe798e23e838f210246b74427b3d9fe7b5f9dc5dca5a673452d796e5ef1f6fe14e5ebe798e23e838f53ae",
      "index": 1573,
      "you_confirmed": true,
      "counterparty_confirmed": true,
      "confirmations": 1,
      "amount_deposited": "11.00000000",
      "amount_released": "11.00000000",
      "deposit_transaction_id": "txid_16",
      "release_transaction_id": "456..."
    }
  }
}

Signing refund transaction of contract

This method seller should call after viewing & verifying refund transaction. Provide signed transaction as hex string in the 'hex' parameter.

Endpoint

POST /api/v1/contracts/:id/refund_transaction

Parameters

Name Description
id

Contract ID

hex

Hex string which represents signed transaction

Request

Route

POST /api/v1/contracts/g8MwtTmGb2fJF2DM/refund_transaction

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "hex": "01000000000101678a8e2c7f513b26dff0d8ce8cfc4502f881c227ee04a3303269ac3cf470698c0000000023220020c5dd11c968cf13500f9cf8fcb2e851dd0bb7ea80a1382d639e9eedffa93806f8ffffffff02cca30200000000001976a914ac288fdff4b0bce5a92c3a36b521f05ec8b04fe788ac16040000000000001600149c8653aa0f661dec64a4cd2dc7f7a817a69cfa270400483045022100e73f9e47c251d199eec3623572403794f10648784251aaf4363825cf9d19511c02202c77e36a22b1c6bdaf1f5addb85397af22b60d5382769d7402e07d638832040101483045022100dfd0582dd26edc54348063e597730eadaa96862489d2e2321881bc638aaaab5102201d4e4488a1ca7456aca02838ed29c33f9db67dfac3b3e5c3e685d72556ac83c5016952210259acf58df1360fa96556d1aa00e8bb928d790557e666cd90b3ef8a0dae1b5c702102dc8a3d88e82e9f6d22d6f76d47c6f5c41aed53cfb926bfdbafae25852d3b540621032756f513a93f1443105eef0c11b2164b8c7995d07152331191e536df9232ed1653ae00000000"
}

cURL

curl "hodlhodl.com/api/v1/contracts/g8MwtTmGb2fJF2DM/refund_transaction" -d '{"hex":"01000000000101678a8e2c7f513b26dff0d8ce8cfc4502f881c227ee04a3303269ac3cf470698c0000000023220020c5dd11c968cf13500f9cf8fcb2e851dd0bb7ea80a1382d639e9eedffa93806f8ffffffff02cca30200000000001976a914ac288fdff4b0bce5a92c3a36b521f05ec8b04fe788ac16040000000000001600149c8653aa0f661dec64a4cd2dc7f7a817a69cfa270400483045022100e73f9e47c251d199eec3623572403794f10648784251aaf4363825cf9d19511c02202c77e36a22b1c6bdaf1f5addb85397af22b60d5382769d7402e07d638832040101483045022100dfd0582dd26edc54348063e597730eadaa96862489d2e2321881bc638aaaab5102201d4e4488a1ca7456aca02838ed29c33f9db67dfac3b3e5c3e685d72556ac83c5016952210259acf58df1360fa96556d1aa00e8bb928d790557e666cd90b3ef8a0dae1b5c702102dc8a3d88e82e9f6d22d6f76d47c6f5c41aed53cfb926bfdbafae25852d3b540621032756f513a93f1443105eef0c11b2164b8c7995d07152331191e536df9232ed1653ae00000000"}' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "g8MwtTmGb2fJF2DM",
    "your_role": "seller",
    "can_be_canceled": false,
    "offer_id": "Lr8uf2Vj9SsTyZgm",
    "price": "7000.00",
    "value": "7218.41",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": false,
    "confirmations": 2,
    "payment_window_seconds_left": 3599535000,
    "payment_window_time_left_seconds": 3599535000,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "completed",
    "dispute_status": null,
    "payment_method_instruction": {
      "payment_method_id": "9400",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "762.38",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.03",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 104",
    "country_code": "Country Code 104",
    "created_at": "2024-08-29T23:13:33.117678Z",
    "counterparty": {
      "login": "us4r68",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 1,
      "url": "http://localhost:3000/users/us4r68",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 103",
      "country_code": "Country Code 103",
      "average_payment_time_minutes": 0,
      "average_release_time_minutes": null,
      "days_since_last_trade": 0,
      "blocked_by": 0
    },
    "escrow": {
      "address": "2MwyCcWt8ESP5MM9xCf4n3RzhE1ERt3mKTj",
      "witness_script": "522102230c6cdd6d942d018b3f15465edc37b4a8ad737115f01cf92058741775e6d3242103a81db1e2afe988c2f9b43e0c7e78d96047c68c926cd7a96f9345e638b547425b2103a81db1e2afe988c2f9b43e0c7e78d96047c68c926cd7a96f9345e638b547425b53ae",
      "index": 1574,
      "you_confirmed": true,
      "counterparty_confirmed": true,
      "confirmations": 1,
      "amount_deposited": "11.00000000",
      "amount_released": "11.00000000",
      "deposit_transaction_id": "txid_17",
      "release_transaction_id": "456..."
    }
  }
}

Starting dispute on the contract

Starts the dispute.

Dispute could be started:

  • by the seller — when the contract status is 'paid'
  • by the buyer — when the contract status is 'paid' and payment window has expired

Endpoint

POST /api/v1/contracts/:id/dispute

Parameters

Name Description
id

Contract ID

Request

Route

POST /api/v1/contracts/vmqdFZCM18DstET0/dispute

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/contracts/vmqdFZCM18DstET0/dispute" -d '' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
contract

Contract (see Getting contract for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "contract": {
    "id": "vmqdFZCM18DstET0",
    "your_role": "seller",
    "can_be_canceled": false,
    "offer_id": "yv3Yg41hMZgEbKBp",
    "price": "700.00",
    "value": "7904.55",
    "currency_code": "EUR",
    "volume": "10.89108911",
    "asset_code": "BTC",
    "comment": "Sell me bitcoins, I agree to the terms!",
    "current_user_has_unreleased_funds": false,
    "confirmations": 2,
    "payment_window_seconds_left": 3599668000,
    "payment_window_time_left_seconds": 3599668000,
    "payment_window_minutes": 60,
    "depositing_window_minutes": 30,
    "depositing_window_time_left_seconds": null,
    "status": "disputed",
    "dispute_status": "unresolved",
    "payment_method_instruction": {
      "payment_method_id": "9402",
      "payment_method_name": "Some Bank",
      "details": "Wire transfer to account #123123"
    },
    "volume_breakdown": {
      "volume_with_fee": "11.00000000",
      "goes_to_buyer": "10.78217822",
      "exchange_fee": "0.10891089",
      "exchange_fee_in_fiat": "76.24",
      "exchange_fee_percent": "1.0",
      "transaction_fee": "0.00000370",
      "transaction_fee_in_fiat": "0.00",
      "intermediary_fee": "0.00000000",
      "intermediary_fee_in_fiat": "0.00",
      "intermediary_fee_percent": 0.0
    },
    "country": "Country 106",
    "country_code": "Country Code 106",
    "created_at": "2024-08-29T23:13:33.839957Z",
    "counterparty": {
      "login": "us4r70",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://localhost:3000/users/us4r70",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 105",
      "country_code": "Country Code 105",
      "average_payment_time_minutes": 0,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "escrow": {
      "address": "2NEHBXJn3Jvf4WT6vwwt8u5K33Mq9KiPaMf",
      "witness_script": "52210259ef773c7b5690da128a98c79c1c3479e94a2b345927a4a0fa1c5c2c783847622103d1d70bf09b27bdd4a45bca38e7a22e71ecf5cc1ecfe0a1dbd5cff207c56a11f82103d1d70bf09b27bdd4a45bca38e7a22e71ecf5cc1ecfe0a1dbd5cff207c56a11f853ae",
      "index": 1575,
      "you_confirmed": true,
      "counterparty_confirmed": true,
      "confirmations": 1,
      "amount_deposited": "11.00000000",
      "amount_released": null,
      "deposit_transaction_id": "txid_18",
      "release_transaction_id": null
    }
  }
}

Countries

Countries resource

Listing countries

Note. Example here doesn’t list actual countries. Do an actual query to the API server to get the list.

Endpoint

GET /api/v1/countries

Request

Route

GET /api/v1/countries

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/countries" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
countries

Countries array

countries[#].code

Code

countries[#].name

Name

countries[#].native_name

Name as written in the country’s language

countries[#].currency_code

State currency code

countries[#].currency_name

State currency name

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "countries": [
    {
      "code": "AU",
      "name": "Australia",
      "native_name": "Australia",
      "currency_code": "AUD",
      "currency_name": "Australian dollar"
    },
    {
      "code": "RU",
      "name": "Russia",
      "native_name": "Россия",
      "currency_code": "RUB",
      "currency_name": "Russian ruble"
    }
  ]
}

Currencies

Currencies resource

Listing currencies

Note. Example here doesn’t list actual currencies. Do an actual query to the API server to get the list.

Endpoint

GET /api/v1/currencies

Request

Route

GET /api/v1/currencies

cURL

curl -g "hodlhodl.com/api/v1/currencies" -X GET \
	-H "Version: HTTP/1.0"

Response

Simulated Response

Response Fields

Name Description
currencies

Currencies array

currency[#].code

Code

currency[#].name

Name

currency[#].type

“fiat” or “crypto”

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "currencies": [
    {
      "code": "AUD",
      "name": "Australian dollar",
      "type": "fiat"
    },
    {
      "code": "RUB",
      "name": "Russian ruble",
      "type": "fiat"
    }
  ]
}

Exchange rate providers

Exchange rate providers resource

Listing exchange rate providers

Note. Example here doesn’t list actual exchange rate providers. Do an actual query to the API server to get the list.

Endpoint

GET /api/v1/exchange_rate_providers

Request

Route

GET /api/v1/exchange_rate_providers

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/exchange_rate_providers" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
exchange_rate_providers

Exchange rate providers array

exchange_rate_providers[#].name

Name

exchange_rate_providers[#].currency_codes

Array of currency codes

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "exchange_rate_providers": [
    {
      "name": "Bitpay",
      "currency_codes": [
        "AUD",
        "BCH",
        "USD"
      ]
    },
    {
      "name": "Bitstamp",
      "currency_codes": [
        "AUD",
        "BCH",
        "ETH",
        "USD",
        "XRP"
      ]
    }
  ]
}

Notifications

Notifications resource

Reading notifications

This method fetches all unread notification and marks them as read.

A client must show all notifications which it fetched.

A client must show all textual fields of the notification: title, body, link. Link should be clickable. Clients should show notifications in a way suitable for a particular UI environment which client targets, ensuring best user experience.

Note: body of a notification could be multiline (standard line feeds \n will be used). Title, body and link are all plain-text (no HTML markup).

Endpoint

POST /api/v1/notifications/read

Request

Route

POST /api/v1/notifications/read

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/notifications/read" -d '' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
notifications

Notifications array

notifications[#].id

ID of notification

notifications[#].title

Title

notifications[#].body

Body (could contain \n; could be null) 1

notifications[#].link

Hyperlink (could be null)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "notifications": [
    {
      "id": "5307",
      "title": "Hello, this is a notification!",
      "body": "Dear user. The seller in one of your contracts deposited bitcoins.",
      "link": "https://hodlhodl.com/contracts/123"
    },
    {
      "id": "5308",
      "title": "Hello, this is a notification!",
      "body": "Dear user. The seller in one of your contracts deposited bitcoins.",
      "link": "https://hodlhodl.com/contracts/123"
    },
    {
      "id": "5309",
      "title": "Hello, this is a notification!",
      "body": "Dear user. The seller in one of your contracts deposited bitcoins.",
      "link": "https://hodlhodl.com/contracts/123"
    }
  ]
}

Offers

Offers resource

Getting offer

Note 1: total fee consists of “trading fee” and “transaction fee”. Trading fee is calculated as minimum among buyer and seller fee. User fee is calculated as base fee rate minus discount for online presence. Transaction fee is estimated according to current blockchain situation.

Note 2: list of all payment methods, used across the exchange, could be obtained by querying “Payment methods” resource.

Note 3: country and country_code will be "Global" for worldwide offers/traders.

Endpoint

GET /api/v1/offers/:id

Parameters

Name Description
id

Offer ID

Request

Route

GET /api/v1/offers/TrN9PR1g8rEtGwLr

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/offers/TrN9PR1g8rEtGwLr" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
offer

Offer resource

offer.id

ID

offer.version

Version

offer.asset_code

Asset code. Currently only ‘BTC’ is supported

offer.searchable

Will appear in the search? (true or false)

Note that even non-private offer can be unlisted if it’s not enabled or blocked. This field will show whether the offer will actually be shown in the search.

offer.country

Country name (or "Global")

offer.country_code

Country code (or "Global")

offer.working_now

Does current time suit working_hours_(start|end) and workdays_only (true or false)

offer.side

"buy" or "sell"

offer.title

Title

offer.description

Description

offer.currency_code

Currency code

offer.price

Price (in currency_code fiat currency)

offer.amount_source

Amount source ("sats" or "fiat")

offer.min_amount

Minimal trade amount (in currency_code fiat currency)

offer.max_amount

Maximal trade amount (in currency_code fiat currency)

offer.first_trade_limit

First trade limit (in currency_code fiat currency)

offer.balance

Balance (i.e. maximum sum of all contracts yet to be created) (in currency_code fiat currency)

offer.initial_balance

Initial balance (i.e. balance set by the user) (in currency_code fiat currency)

offer.min_amount_sats

Minimal trade amount (in satoshi)

offer.max_amount_sats

Maximal trade amount (in satoshi)

offer.first_trade_limit_sats

First trade limit (in satoshi)

offer.balance_sats

Balance (i.e. maximum sum of all contracts yet to be created) (in satoshi)

offer.initial_balance_sats

Initial balance (i.e. balance set by the user) (in satoshi)

offer.for_experienced_users

Allow create a contract with experienced users only? (true or false)

An “Experienced user” is a user who has successfully completed at least one contract and is therefore familiar with the process of trading on Hodl Hodl.

This condition is applicable only for public offers and doesn’t apply to private offers.

offer.fee

Fee details 1

offer.fee.intermediary_fee_rate

Intermediary fee rate (decimal fraction)

offer.fee.author_fee_rate

Offer’s creator fee rate (decimal fraction)

offer.fee.your_fee_rate

Your fee rate (decimal fraction) (only available in Getting offer method)

offer.fee.transaction_fee

Transaction fee estimation (BTC) (only available in Getting offer method)

offer.fee.exchange_fee_percent

Trading fee in % (decimal fraction) (only available in Getting offer method)

offer.payment_window_minutes

Payment window

offer.confirmations

Blockchain confirmations required for deposit transaction in order for Contract to be considered "Deposited"

offer.payment_methods

Array of payment methods

Note: only present for “buy” offers.

offer.payment_methods[#].id

ID of the payment method

offer.payment_methods[#].type

Type of the payment method

offer.payment_methods[#].name

Name of the payment method

offer.payment_method_instructions

Array of accepted payment methods with instructions 2

Note: only present for “sell” offers.

offer.payment_method_instructions[#].id

ID of the instruction

offer.payment_method_instructions[#].version

Version

offer.payment_method_instructions[#].payment_method_id

ID of the instruction’s payment method

offer.payment_method_instructions[#].payment_method_type

Type of the instruction’s payment method

offer.payment_method_instructions[#].payment_method_name

Name of the instruction’s payment method

offer.payment_method_instructions[#].details

Text of the instruction (only shows in Getting offer method for the offer creator)

offer.trader

Offer creator information

offer.trader.login

Login

offer.trader.online_status

"online", "recently_online" or "offline"

offer.trader.rating

Rating (as fraction of 1)

offer.trader.trades_count

Number of conducted trades

offer.trader.url

Hodlhodl website URL

offer.trader.verified

Verified? (true or false)

offer.trader.verified_by

Login of the Strong Hodler who verified this user

offer.trader.strong_hodler

Strong Hodler? (true or false)

Strong Hodler is a member of Hodl Hodl volunteer team that we’re working directly with.

offer.trader.country

Country name (or "Global")

offer.trader.country_code

Country code (or "Global")

offer.trader.average_payment_time_minutes

Average payment time (in minutes)

offer.trader.average_release_time_minutes

Average release time (in minutes)

offer.trader.days_since_last_trade

Number of days since last trade

offer.trader.blocked_by

How many traders blocked this user

The following is shown only for the Offer’s creator:

offer.created_at

Creation datetime in UTC, ISO8601 (YYYY-MM-DDThh:mm:ssZ)

offer.price_source

"fixed_value", "exchange_rate"

offer.working_hours_start_utc

Working hours start in UTC (HH:MM)

offer.working_hours_end_utc

Working hours end in UTC (HH:MM)

offer.working_hours_start_in_timezone

Working hours start in (offer.timezone || offer.timezone) (HH:MM)

offer.working_hours_end_in_timezone

Working hours end in (offer.timezone || offer.timezone) (HH:MM)

offer.workdays_only

Does offer work only on workdays (true or false) default: false

offer.timezone

Offer’s timezone (null means offer uses creator’s timezone)

offer.stop_loss_value

Stop loss value (in currency_code fiat currency) or null

offer.enabled

Enabled? (true or false)

Only the offer’s creator will be able to access an offer if it is not enabled. Trades won’t be conducted. (This is the same as ‘Enabled’ checkbox in the web interface.)

offer.private

Hide the offer from search results? (true or false)

Only non-private offers will appear in the search/list website pages and API responses. (This option is the same as ‘Private’ checkbox in the website form.)

offer.configured_max_amount

Configured by the Offer’s creator maximum amount (in currency_code fiat currency)

offer.configured_max_amount_sats

Configured by the Offer’s creator maximum amount (in satoshi)

The following is shown only for the Offer’s creator in the Getting offer method and if price_source is "exchange_rate" (otherwise they will be null)

offer.exchange_rate_provider

Exchange rate provider name (null if the Offer is fixed price)

offer.exchange_price_deviation

Difference between the offer’s price and price on the exchange (null if the Offer is fixed price)

offer.exchange_price_sign

"+" or "-" (null if the Offer is fixed price)

offer.exchange_price_unit

"%" or "currency" (null if the Offer is fixed price)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "offer": {
    "id": "TrN9PR1g8rEtGwLr",
    "version": "etzrk0",
    "asset_code": "BTC",
    "searchable": true,
    "country": "Country 111",
    "country_code": "Country Code 111",
    "working_now": true,
    "side": "sell",
    "title": "Offer's title",
    "description": "You give me money, I'll give you bitcoins",
    "currency_code": "USD",
    "price": "725.53",
    "amount_source": "fiat",
    "min_amount": "0.20",
    "max_amount": "700.00",
    "first_trade_limit": null,
    "balance": null,
    "initial_balance": null,
    "min_amount_sats": "27566",
    "max_amount_sats": "96481725",
    "first_trade_limit_sats": null,
    "balance_sats": null,
    "initial_balance_sats": null,
    "fee": {
      "author_fee_rate": "0.01000000",
      "intermediary_fee_rate": "0.00000000",
      "your_fee_rate": "0.01000000",
      "transaction_fee": "0.00000370",
      "exchange_fee_percent": "1.0"
    },
    "payment_window_minutes": 60,
    "confirmations": 1,
    "payment_method_instructions": [
      {
        "id": "8379",
        "version": "ezdto0",
        "payment_method_id": "9404",
        "payment_method_type": "Online payment system",
        "payment_method_name": "Yandex Money 60"
      }
    ],
    "trader": {
      "login": "us4r73",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://hodlhodl.com/accounts/us4r73",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 110",
      "country_code": "Country Code 110",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    }
  }
}

Searching/listing offers

Note 1. All filters could be ommitted.

Endpoint

GET /api/v1/offers

Parameters

Name Description
pagination.limit

Number of records to return (default 50, maximum 100)

pagination.offset

Number of records to skip (e.g. 50 for second page of results with the default limit)

filters.asset_code

Asset code. Currently only ‘BTC’ is supported

filters.side

"buy" or "sell"

filters.include_global

Include global offers? (true or false, default false)

Note: if this parameter is true, then global offers will be included in addition to ones select by country filter.

filters.only_working_now

Does current time suit working_hours_(start|end) and workdays_only (true or false)

filters.country

Country (code or name)

filters.currency_code

Currency code

filters.payment_method_id

ID of payment method (see Payment methods/Listing payment methods)

Note: if this parameter is set, then payment_method_type and payment_method_name will be ignored.

filters.payment_method_type

Type of payment method

filters.payment_method_name

Name of payment method

filters.amount

Amount (min offer amount <= amount >= max offer amount)

filters.payment_window_minutes_max

Maximum payment window (in minutes)

filters.user_average_payment_time_minutes_max

Offer’s creator maximum payment time (in minutes)

filters.user_average_release_time_minutes_max

Offer’s creator maximum average release time (in minutes)

sort.direction

"asc" for ascending order (default) or "desc" for descdending

sort.by

Field to sort by, possible values:

  • "price" — offer’s price (default)
  • "payment_window_minutes" — offer’s payment window (in minutes)
  • "user_average_payment_time_minutes" — an offer creator’s average payment time
  • "user_average_release_time_minutes" — an offer creator’s average release time
  • "rating" — an offer creator’s rating

Request

Route

GET /api/v1/offers?filters[user_average_release_time_minutes_max]=25

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Query Parameters as JSON

{
  "filters": {
    "user_average_release_time_minutes_max": "25"
  }
}

cURL

curl -g "hodlhodl.com/api/v1/offers?filters[user_average_release_time_minutes_max]=25" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
offers

Array of Offers (see Getting offer for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "filters": {
    "user_average_release_time_minutes_max": 25,
    "only_working_now": false,
    "include_global": true
  },
  "sort": {
    "direction": "asc",
    "by": "price"
  },
  "pagination": {
    "limit": 50,
    "offset": 0
  },
  "offers": [
    {
      "id": "kzxrWURI3XxZPqfY",
      "version": "2fs0sw",
      "asset_code": "BTC",
      "searchable": true,
      "country": "Country 113",
      "country_code": "Country Code 113",
      "working_now": true,
      "side": "sell",
      "title": null,
      "description": "You give me money, I'll give you bitcoins",
      "currency_code": "USD",
      "price": "725.53",
      "amount_source": "fiat",
      "min_amount": "0.20",
      "max_amount": "700.00",
      "first_trade_limit": null,
      "balance": null,
      "initial_balance": null,
      "min_amount_sats": "27566",
      "max_amount_sats": "96481725",
      "first_trade_limit_sats": null,
      "balance_sats": null,
      "initial_balance_sats": null,
      "fee": {
        "author_fee_rate": "0.01000000",
        "intermediary_fee_rate": "0.00000000",
        "your_fee_rate": "0.01000000",
        "transaction_fee": "0.00000370",
        "exchange_fee_percent": "1.0"
      },
      "payment_window_minutes": 40,
      "confirmations": 1,
      "payment_method_instructions": [
        {
          "id": "8380",
          "version": "2ky33s",
          "payment_method_id": "9405",
          "payment_method_type": "Online payment system",
          "payment_method_name": "Yandex Money 61"
        }
      ],
      "trader": {
        "login": "us4r74",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": "0.90",
        "my_review": null,
        "trades_count": 0,
        "url": "http://hodlhodl.com/accounts/us4r74",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 112",
        "country_code": "Country Code 112",
        "average_payment_time_minutes": 20,
        "average_release_time_minutes": 20,
        "days_since_last_trade": null,
        "blocked_by": 0
      }
    },
    {
      "id": "CHsOD3YSUoKVgV5K",
      "version": "3fhx8o",
      "asset_code": "BTC",
      "searchable": true,
      "country": "Country 114",
      "country_code": "Country Code 114",
      "working_now": true,
      "side": "sell",
      "title": null,
      "description": "You give me money, I'll give you bitcoins",
      "currency_code": "USD",
      "price": "725.53",
      "amount_source": "fiat",
      "min_amount": "0.20",
      "max_amount": "700.00",
      "first_trade_limit": null,
      "balance": null,
      "initial_balance": null,
      "min_amount_sats": "27566",
      "max_amount_sats": "96481725",
      "first_trade_limit_sats": null,
      "balance_sats": null,
      "initial_balance_sats": null,
      "fee": {
        "author_fee_rate": "0.01000000",
        "intermediary_fee_rate": "0.00000000",
        "your_fee_rate": "0.01000000",
        "transaction_fee": "0.00000370",
        "exchange_fee_percent": "1.0"
      },
      "payment_window_minutes": 35,
      "confirmations": 1,
      "payment_method_instructions": [
        {
          "id": "8381",
          "version": "3kkops",
          "payment_method_id": "9406",
          "payment_method_type": "Online payment system",
          "payment_method_name": "Yandex Money 62"
        }
      ],
      "trader": {
        "login": "us4r74",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": "0.90",
        "my_review": null,
        "trades_count": 0,
        "url": "http://hodlhodl.com/accounts/us4r74",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 112",
        "country_code": "Country Code 112",
        "average_payment_time_minutes": 20,
        "average_release_time_minutes": 20,
        "days_since_last_trade": null,
        "blocked_by": 0
      }
    }
  ]
}

Listing my offers

This method will return all your existing offers, recently created first.

Endpoint

GET /api/v1/offers/my

Request

Route

GET /api/v1/offers/my

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/offers/my" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
offers

Array of Offers (see Getting offer for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "offers": [
    {
      "id": "ccTZYjXZwiC3bK2u",
      "version": "9k6uzk",
      "asset_code": "BTC",
      "searchable": true,
      "country": "Country 118",
      "country_code": "Country Code 118",
      "working_now": true,
      "side": "sell",
      "title": null,
      "description": "You give me money, I'll give you bitcoins",
      "currency_code": "USD",
      "price": "725.53",
      "amount_source": "fiat",
      "min_amount": "0.20",
      "max_amount": "700.00",
      "first_trade_limit": null,
      "balance": null,
      "initial_balance": null,
      "min_amount_sats": "27566",
      "max_amount_sats": "96481725",
      "first_trade_limit_sats": null,
      "balance_sats": null,
      "initial_balance_sats": null,
      "fee": {
        "author_fee_rate": "0.01000000",
        "intermediary_fee_rate": "0.00000000",
        "your_fee_rate": "0.01000000",
        "transaction_fee": "0.00000370",
        "exchange_fee_percent": "1.0"
      },
      "payment_window_minutes": 35,
      "confirmations": 1,
      "payment_method_instructions": [
        {
          "id": "8384",
          "version": "9p8oig",
          "payment_method_id": "9409",
          "payment_method_type": "Online payment system",
          "payment_method_name": "Yandex Money 65",
          "details": "Send money over to account 123"
        }
      ],
      "trader": {
        "login": "test_user",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": null,
        "my_review": null,
        "trades_count": 0,
        "url": "http://hodlhodl.com/accounts/test_user",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 116",
        "country_code": "Country Code 116",
        "average_payment_time_minutes": null,
        "average_release_time_minutes": null,
        "days_since_last_trade": null,
        "blocked_by": 0
      },
      "created_at": "2024-08-29T23:13:35Z",
      "working_hours_start_utc": "22:13",
      "working_hours_end_utc": "00:13",
      "working_hours_start_in_timezone": "22:13",
      "working_hours_end_in_timezone": "00:13",
      "timezone": "UTC",
      "workdays_only": false,
      "stop_loss_value": null,
      "enabled": true,
      "private": false,
      "for_experienced_users": false,
      "price_source": "exchange_rate",
      "exchange_rate_provider": "Bitstamp",
      "exchange_price_deviation": "2.00000000",
      "exchange_price_sign": "+",
      "exchange_price_unit": "%",
      "configured_max_amount": "700.00",
      "configured_max_amount_sats": "96481725"
    },
    {
      "id": "sPnZj8K4z9myTJvy",
      "version": "8jiru8",
      "asset_code": "BTC",
      "searchable": true,
      "country": "Country 117",
      "country_code": "Country Code 117",
      "working_now": true,
      "side": "sell",
      "title": null,
      "description": "You give me money, I'll give you bitcoins",
      "currency_code": "USD",
      "price": "725.53",
      "amount_source": "fiat",
      "min_amount": "0.20",
      "max_amount": "700.00",
      "first_trade_limit": null,
      "balance": null,
      "initial_balance": null,
      "min_amount_sats": "27566",
      "max_amount_sats": "96481725",
      "first_trade_limit_sats": null,
      "balance_sats": null,
      "initial_balance_sats": null,
      "fee": {
        "author_fee_rate": "0.01000000",
        "intermediary_fee_rate": "0.00000000",
        "your_fee_rate": "0.01000000",
        "transaction_fee": "0.00000370",
        "exchange_fee_percent": "1.0"
      },
      "payment_window_minutes": 40,
      "confirmations": 1,
      "payment_method_instructions": [
        {
          "id": "8383",
          "version": "8or35s",
          "payment_method_id": "9408",
          "payment_method_type": "Online payment system",
          "payment_method_name": "Yandex Money 64",
          "details": "Send money over to account 123"
        }
      ],
      "trader": {
        "login": "test_user",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": null,
        "my_review": null,
        "trades_count": 0,
        "url": "http://hodlhodl.com/accounts/test_user",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 116",
        "country_code": "Country Code 116",
        "average_payment_time_minutes": null,
        "average_release_time_minutes": null,
        "days_since_last_trade": null,
        "blocked_by": 0
      },
      "created_at": "2024-08-29T23:13:35Z",
      "working_hours_start_utc": "22:13",
      "working_hours_end_utc": "00:13",
      "working_hours_start_in_timezone": "22:13",
      "working_hours_end_in_timezone": "00:13",
      "timezone": "UTC",
      "workdays_only": false,
      "stop_loss_value": null,
      "enabled": true,
      "private": false,
      "for_experienced_users": false,
      "price_source": "exchange_rate",
      "exchange_rate_provider": "Bitstamp",
      "exchange_price_deviation": "2.00000000",
      "exchange_price_sign": "+",
      "exchange_price_unit": "%",
      "configured_max_amount": "700.00",
      "configured_max_amount_sats": "96481725"
    }
  ]
}

Fetching newly created offers

This method allows you to fetch newly created offer.

Store pagination.last_id from the first response of this method call on the client. Provide pagination.last_id as pagination.newer_than_id parameter to the next method call to fetch offers which were created strictly after the one with last_id. Repeat until all offers are fetched (offers is []).

Pseudocode to fetch all offers would look like this:

last_id = retrieve_last_id_from_local_db || null
result = fetch_new("pagination": {"newer_than_id": last_id})

while result["offers"] != []
  save_offers_to_local_db(result["offers"])

  last_id = result["pagination"]["last_id"]
  result = fetch_new("pagination": {"newer_than_id": last_id})
end

save_last_id_to_local_db(last_id)

Offers in the response will always be sorted from the oldest to the newest.

Endpoint

GET /api/v1/offers/fetch_new

Parameters

Name Description
pagination.newer_than_id

Set to pagination.last_id value from the previous request (omit it or set to known offer’s ID as initial value)

filters.asset_code

Asset code. Currently only ‘BTC’ is supported

filters.side

"buy" or "sell"

filters.include_global

Include global offers? (true or false, default false)

Note: if this parameter is true, then global offers will be included in addition to ones selected by country filter.

filters.only_working_now

Does current time suit working_hours_(start|end) and workdays_only (true or false, default false)

filters.country

Country (code or name)

filters.currency_code

Currency code

filters.payment_method_id

ID of payment method (see Payment methods/Listing payment methods)

Note: if this parameter is set, then payment_method_type and payment_method_name will be ignored.

filters.payment_method_type

Type of payment method (see Payment methods/Listing payment methods)

filters.payment_method_name

Name of payment method

filters.amount

Amount (min offer amount <= amount >= max offer amount)

filters.payment_window_minutes_max

Maximum payment window (in minutes)

filters.user_average_payment_time_minutes_max

Offer’s creator maximum payment time (in minutes)

filters.user_average_release_time_minutes_max

Offer’s creator maximum average release time (in minutes)

Request

Route

GET /api/v1/offers/fetch_new?filters[user_average_release_time_minutes_max]=25&pagination[newer_than_id]=p5zol6dE4pOUUQxr

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Query Parameters as JSON

{
  "filters": {
    "user_average_release_time_minutes_max": "25"
  },
  "pagination": {
    "newer_than_id": "p5zol6dE4pOUUQxr"
  }
}

cURL

curl -g "hodlhodl.com/api/v1/offers/fetch_new?filters[user_average_release_time_minutes_max]=25&pagination[newer_than_id]=p5zol6dE4pOUUQxr" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
offers

Array of Offers (see Offers/Getting offer for fields description)

filters

Filters values (fetched from the parameters and/or default ones)

pagination.last_id

Newest offer ID to store on the client

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "filters": {
    "user_average_release_time_minutes_max": 25,
    "only_working_now": false,
    "include_global": true
  },
  "pagination": {
    "newer_than_id": "p5zol6dE4pOUUQxr",
    "last_id": "kufFHWtamqMl9lKh"
  },
  "offers": [
    {
      "id": "7y45xqb6sKdC2lKB",
      "version": "ftafds",
      "asset_code": "BTC",
      "searchable": true,
      "country": "Country 122",
      "country_code": "Country Code 122",
      "working_now": true,
      "side": "sell",
      "title": null,
      "description": "You give me money, I'll give you bitcoins",
      "currency_code": "USD",
      "price": "725.53",
      "amount_source": "fiat",
      "min_amount": "0.20",
      "max_amount": "700.00",
      "first_trade_limit": null,
      "balance": null,
      "initial_balance": null,
      "min_amount_sats": "27566",
      "max_amount_sats": "96481725",
      "first_trade_limit_sats": null,
      "balance_sats": null,
      "initial_balance_sats": null,
      "fee": {
        "author_fee_rate": "0.01000000",
        "intermediary_fee_rate": "0.00000000",
        "your_fee_rate": "0.01000000",
        "transaction_fee": "0.00000370",
        "exchange_fee_percent": "1.0"
      },
      "payment_window_minutes": 35,
      "confirmations": 1,
      "payment_method_instructions": [
        {
          "id": "8387",
          "version": "fz0zc8",
          "payment_method_id": "9412",
          "payment_method_type": "Online payment system",
          "payment_method_name": "Yandex Money 68"
        }
      ],
      "trader": {
        "login": "us4r77",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": "0.90",
        "my_review": null,
        "trades_count": 0,
        "url": "http://hodlhodl.com/accounts/us4r77",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 120",
        "country_code": "Country Code 120",
        "average_payment_time_minutes": 20,
        "average_release_time_minutes": 20,
        "days_since_last_trade": null,
        "blocked_by": 0
      }
    },
    {
      "id": "kufFHWtamqMl9lKh",
      "version": "d0sjk",
      "asset_code": "BTC",
      "searchable": true,
      "country": "Country 123",
      "country_code": "Country Code 123",
      "working_now": true,
      "side": "sell",
      "title": null,
      "description": "You give me money, I'll give you bitcoins",
      "currency_code": "USD",
      "price": "725.53",
      "amount_source": "fiat",
      "min_amount": "0.20",
      "max_amount": "700.00",
      "first_trade_limit": null,
      "balance": null,
      "initial_balance": null,
      "min_amount_sats": "27566",
      "max_amount_sats": "96481725",
      "first_trade_limit_sats": null,
      "balance_sats": null,
      "initial_balance_sats": null,
      "fee": {
        "author_fee_rate": "0.01000000",
        "intermediary_fee_rate": "0.00000000",
        "your_fee_rate": "0.01000000",
        "transaction_fee": "0.00000370",
        "exchange_fee_percent": "1.0"
      },
      "payment_window_minutes": 34,
      "confirmations": 1,
      "payment_method_instructions": [
        {
          "id": "8388",
          "version": "iwyns",
          "payment_method_id": "9413",
          "payment_method_type": "Online payment system",
          "payment_method_name": "Yandex Money 69"
        }
      ],
      "trader": {
        "login": "us4r77",
        "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
        "online_status": "offline",
        "rating": "0.90",
        "my_review": null,
        "trades_count": 0,
        "url": "http://hodlhodl.com/accounts/us4r77",
        "verified": false,
        "verified_by": null,
        "strong_hodler": false,
        "country": "Country 120",
        "country_code": "Country Code 120",
        "average_payment_time_minutes": 20,
        "average_release_time_minutes": 20,
        "days_since_last_trade": null,
        "blocked_by": 0
      }
    }
  ]
}

Creating offer

Endpoint

POST /api/v1/offers

Parameters

Name Description
offer.asset_code

Asset code. Currently only ‘BTC’ is supported

offer.side

"buy" or "sell" (required)

offer.country_code

Country code (assumed Global if ommited)

offer.currency_code

Currency code (required)

Use Currencies/Listring currencies to get currency code.

offer.stop_loss_value

Stop loss value (in currency_code fiat currency)

offer.for_experienced_users

Allow create a contract with experienced users only? (true or false)

An “Experienced user” is a user who has successfully completed at least one contract and is therefore familiar with the process of trading on Hodl Hodl.

This condition is applicable only for public offers and doesn’t apply to private offers.

offer.confirmations

Blockchain confirmations required for deposit transaction in order for Contract to be considered "Deposited" (default 1)

offer.payment_window_minutes

Payment window (default 90)

offer.workdays_only

true or false (default false)

offer.title

Title

offer.description

Description

offer.enabled

Enabled? (true or false, default false)

Only the offer’s creator will be able to access an offer if it is not enabled. Trades won’t be conducted. (This is the same as ‘Enabled’ checkbox in the web interface.)

offer.private

Hide the offer from search results? (true or false)

Only non-private offers will appear in the search/list website pages and API responses. (This option is the same as ‘Private’ checkbox in the website form.)

offer.payment_method_ids

Array of payment method IDs (see Payment methods/Listing payment methods)

Note: required only for “buy” offers.

offer.payment_method_instruction_ids

Array of payment method instruction IDs (see Payment method instructions)

Note: required only for “sell” offers.

this fields sets amount source to fiat

offer.balance

Balance (i.e. maximum sum of all contracts yet to be created) (in currency_code fiat currency)

offer.min_amount

Minimal trade amount (in currency_code fiat currency) (required)

offer.max_amount

Maximal trade amount (in currency_code fiat currency) (required, 0 for auto-adjust)

offer.first_trade_limit

First trade limit (in currency_code fiat currency)

this fields sets amount source to satoshi

offer.balance_sats

Balance (i.e. maximum sum of all contracts yet to be created) (in satoshi)

offer.min_amount_sats

Minimal trade amount (in satoshi) (required)

offer.max_amount_sats

Maximal trade amount (in satoshi) (required, 0 for auto-adjust)

offer.first_trade_limit_sats

First trade limit (in satoshi)

Managing working hours

offer.working_hours_start_in_timezone

Working hours start in (offer.timezone || user.timezone) (HH:MM)

(default "00:00", half hours increments)

offer.working_hours_end_in_timezone

Working hours end in (offer.timezone || user.timezone) (HH:MM)

(default "00:00", half hours increments)

offer.timezone

Offer’s timezone (Sets timezone different from user.timezone)

(available only with working_hours_start_in_timezone and working_hours_end_in_timezone)

or

offer.working_hours_start_utc

Working hours start in UTC (HH:MM) (half hours increments)

implicitly sets offer.timezone to UTC

offer.working_hours_end_utc

Working hours end in UTC (HH:MM) (half hours increments)

implicitly sets offer.timezone to UTC

If you want to create a fixed-price offer:

offer.price_source

"fixed_value" (required)

offer.price

Price (in currency_code fiat currency) (required)

If you want to create an offer which price follows external exchange rate:

offer.price_source

"exchange_rate" (required)

offer.exchange_rate_provider

Exchange rate provider name (required)

offer.exchange_price_deviation

Difference between the offer’s price and price on the exchange (required)

offer.exchange_price_sign

"+" or "-" (default "+")

offer.exchange_price_unit

"%" or "currency" (default "%")

Request

Route

POST /api/v1/offers

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "offer": {
    "asset_code": "BTC",
    "currency_code": "USD",
    "price_source": "fixed_value",
    "price": 700.0,
    "balance": 20000,
    "side": "buy",
    "country_code": "AU",
    "timezone": "Melbourne",
    "min_amount": 1.0,
    "max_amount": 6000.0,
    "first_trade_limit": 100,
    "for_experienced_users": false,
    "confirmations": 2,
    "payment_window_minutes": 30,
    "working_hours_start_utc": "02:00",
    "working_hours_end_utc": "06:00",
    "description": "The Description",
    "title": "The Title",
    "enabled": true,
    "private": false,
    "payment_method_ids": [
      9415
    ]
  }
}

cURL

curl "hodlhodl.com/api/v1/offers" -d '{"offer":{"asset_code":"BTC","currency_code":"USD","price_source":"fixed_value","price":700.0,"balance":20000,"side":"buy","country_code":"AU","timezone":"Melbourne","min_amount":1.0,"max_amount":6000.0,"first_trade_limit":100,"for_experienced_users":false,"confirmations":2,"payment_window_minutes":30,"working_hours_start_utc":"02:00","working_hours_end_utc":"06:00","description":"The Description","title":"The Title","enabled":true,"private":false,"payment_method_ids":[9415]}}' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
offer

Offer (newly created; see Getting offer for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "offer": {
    "id": "lhjLxfg1Ce9vyeDK",
    "version": "7mvjoz",
    "asset_code": "BTC",
    "searchable": false,
    "country": "Australia",
    "country_code": "AU",
    "working_now": false,
    "side": "buy",
    "title": "The Title",
    "description": "The Description",
    "currency_code": "USD",
    "price": "700.00",
    "amount_source": "fiat",
    "min_amount": "1.00",
    "max_amount": "6000.00",
    "first_trade_limit": "100.00",
    "balance": "20000.00",
    "initial_balance": "20000.00",
    "min_amount_sats": "142857",
    "max_amount_sats": "857142857",
    "first_trade_limit_sats": "14285714",
    "balance_sats": "2857142857",
    "initial_balance_sats": "2857142857",
    "fee": {
      "author_fee_rate": "0.01000000",
      "intermediary_fee_rate": "0.00000000",
      "your_fee_rate": "0.01000000",
      "transaction_fee": "0.00000370",
      "exchange_fee_percent": "1.0"
    },
    "payment_window_minutes": 30,
    "confirmations": 2,
    "payment_methods": [
      {
        "id": "9415",
        "type": "Bank wire",
        "name": "Yandex Money 71"
      }
    ],
    "trader": {
      "login": "test_user",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://hodlhodl.com/accounts/test_user",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 125",
      "country_code": "Country Code 125",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "created_at": "2024-08-29T23:13:36Z",
    "working_hours_start_utc": "16:00",
    "working_hours_end_utc": "20:00",
    "working_hours_start_in_timezone": "02:00",
    "working_hours_end_in_timezone": "06:00",
    "timezone": "Melbourne",
    "workdays_only": false,
    "stop_loss_value": null,
    "enabled": true,
    "private": false,
    "for_experienced_users": false,
    "price_source": "fixed_value",
    "exchange_rate_provider": null,
    "exchange_price_deviation": null,
    "exchange_price_sign": null,
    "exchange_price_unit": null,
    "configured_max_amount": "6000.00",
    "configured_max_amount_sats": "857142857"
  }
}

Updating offer

All parameters (except ID) are optional.

An attribute does’t change if the corresponding parameter isn’t set.

Parameters are the same as in Creating offer method

Endpoint

PUT /api/v1/offers/:id

Parameters

Name Description
id

Offer ID (required)

offer.side

Offer's side "buy" or "sell"

offer.country_code

Country code (assumed Global if ommited)

offer.stop_loss_value

Stop loss value (in currency_code fiat currency)

offer.for_experienced_users

Allow create a contract with experienced users only? (true or false)

An “Experienced user” is a user who has successfully completed at least one contract and is therefore familiar with the process of trading on Hodl Hodl.

This condition is applicable only for public offers and doesn’t apply to private offers.

offer.confirmations

Blockchain confirmations required for deposit transaction in order for Contract to be considered "Deposited"

offer.payment_window_minutes

Payment window, in minutes

offer.workdays_only

true or false (default false)

offer.title

Title

offer.description

Description

offer.enabled

Enabled? (true or false)

Only the offer’s creator will be able to access an offer if it is not enabled. Trades won’t be conducted. (This is the same as ‘Enabled’ checkbox in the web interface.)

offer.private

Hide the offer from search results? (true or false)

Only non-private offers will appear in the search/list website pages and API responses. (This option is the same as ‘Private’ checkbox in the website form.)

offer.payment_method_ids

Array of payment method IDs (see Payment methods/Listing payment methods)

Note: only use it for “buy” offers.

offer.payment_method_instruction_ids

Array of payment method instruction IDs (see Payment method instructions)

Note: only use it for “sell” offers.

this fields sets amount source to fiat

offer.balance

Balance (i.e. maximum sum of all contracts yet to be created) (in currency_code fiat currency)

offer.min_amount

Minimal trade amount (in currency_code fiat currency) (required)

offer.max_amount

Maximal trade amount (in currency_code fiat currency) (required, 0 for auto-adjust)

offer.first_trade_limit

First trade limit (in currency_code fiat currency)

this fields sets amount source to satoshi

offer.balance_sats

Balance (i.e. maximum sum of all contracts yet to be created) (in satoshi)

offer.min_amount_sats

Minimal trade amount (in satoshi) (required)

offer.max_amount_sats

Maximal trade amount (in satoshi) (required, 0 for auto-adjust)

offer.first_trade_limit_sats

First trade limit (in satoshi)

Managing working hours

offer.working_hours_start_in_timezone

Working hours start in (offer.timezone || user.timezone) (HH:MM)

(default "00:00", half hours increments)

offer.working_hours_end_in_timezone

Working hours end in (offer.timezone || user.timezone) (HH:MM)

(default "00:00", half hours increments)

offer.timezone

Offer’s timezone (Sets timezone different from user.timezone)

(available only with working_hours_start_in_timezone and working_hours_end_in_timezone)

or

offer.working_hours_start_utc

Working hours start in UTC (HH:MM) (half hours increments)

implicitly sets offer.timezone to UTC

offer.working_hours_end_utc

Working hours end in UTC (HH:MM) (half hours increments)

implicitly sets offer.timezone to UTC

If you want to update a fixed-price offer (provide none or all of the following):

offer.price_source

"fixed_value"

offer.price

Price (in currency_code fiat currency)

offer.currency_code

Currency code

Use Currencies/Listring currencies to get currency code.

If you want to update an offer which price follows external exchange rate (provide none or all of the following):

offer.price_source

"exchange_rate"

offer.exchange_rate_provider

Exchange rate provider name

offer.exchange_price_deviation

Difference between the offer’s price and price on the exchange

offer.exchange_price_sign

"+" or "-"

offer.exchange_price_unit

"%" or "currency"

offer.currency_code

Currency code

Use Currencies/Listring currencies to get currency code.

Request

Route

PUT /api/v1/offers/jWDKmuo37K5pf15u

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "offer": {
    "title": "New title",
    "description": "New description"
  }
}

cURL

curl "hodlhodl.com/api/v1/offers/jWDKmuo37K5pf15u" -d '{"offer":{"title":"New title","description":"New description"}}' -X PUT \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
offer

Offer (which was updated; see Getting offer for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "offer": {
    "id": "jWDKmuo37K5pf15u",
    "version": "d430ot",
    "asset_code": "BTC",
    "searchable": true,
    "country": "Country 127",
    "country_code": "Country Code 127",
    "working_now": true,
    "side": "sell",
    "title": "New title",
    "description": "New description",
    "currency_code": "USD",
    "price": "725.53",
    "amount_source": "fiat",
    "min_amount": "0.20",
    "max_amount": "700.00",
    "first_trade_limit": null,
    "balance": null,
    "initial_balance": null,
    "min_amount_sats": "27566",
    "max_amount_sats": "96481725",
    "first_trade_limit_sats": null,
    "balance_sats": null,
    "initial_balance_sats": null,
    "fee": {
      "author_fee_rate": "0.01000000",
      "intermediary_fee_rate": "0.00000000",
      "your_fee_rate": "0.01000000",
      "transaction_fee": "0.00000370",
      "exchange_fee_percent": "1.0"
    },
    "payment_window_minutes": 60,
    "confirmations": 1,
    "payment_method_instructions": [
      {
        "id": "8390",
        "version": "c1eavc",
        "payment_method_id": "9416",
        "payment_method_type": "Online payment system",
        "payment_method_name": "Yandex Money 72",
        "details": "Send money over to account 123"
      }
    ],
    "trader": {
      "login": "test_user",
      "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
      "online_status": "offline",
      "rating": null,
      "my_review": null,
      "trades_count": 0,
      "url": "http://hodlhodl.com/accounts/test_user",
      "verified": false,
      "verified_by": null,
      "strong_hodler": false,
      "country": "Country 126",
      "country_code": "Country Code 126",
      "average_payment_time_minutes": null,
      "average_release_time_minutes": null,
      "days_since_last_trade": null,
      "blocked_by": 0
    },
    "created_at": "2024-08-29T23:13:36Z",
    "working_hours_start_utc": "22:13",
    "working_hours_end_utc": "00:13",
    "working_hours_start_in_timezone": "22:13",
    "working_hours_end_in_timezone": "00:13",
    "timezone": "UTC",
    "workdays_only": false,
    "stop_loss_value": null,
    "enabled": true,
    "private": false,
    "for_experienced_users": false,
    "price_source": "exchange_rate",
    "exchange_rate_provider": "Bitstamp",
    "exchange_price_deviation": "2.00000000",
    "exchange_price_sign": "+",
    "exchange_price_unit": "%",
    "configured_max_amount": "700.00",
    "configured_max_amount_sats": "96481725"
  }
}

Deleting offer

Endpoint

DELETE /api/v1/offers/:id

Parameters

Name Description
id

Offer ID

Request

Route

DELETE /api/v1/offers/Fxhj18uhiphlzC6f

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/offers/Fxhj18uhiphlzC6f" -d '' -X DELETE \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Status

204

Fetching tied to exchange price value

Price is calculated from base value - market rate taken from one of supported exchanges and deviation from that rate. Deviation can be defied in percent (+10%) or as absolute value (-200 USD).

In example below we assume that current BTC/USD rate on Bitstamp is equal to 5000.

Endpoint

GET /api/v1/offers/exchange_rate_price

Parameters

Name Description
asset_code

Cryptocurrency asset code. Currently only ‘BTC’ is supported

currency_code

Fiat currency code

provider

Exchange rate provider name (see exchange rates list)

deviation

Deviation from exchange value

sign

+ or - for adding or substraction from provider rate

unit

Deviation unit. Can be % for relative values or currency for absolute values

Request

Route

GET /api/v1/offers/exchange_rate_price?asset_code=BTC&currency_code=USD&provider=Bitstamp&deviation=40&sign=%2B&unit=currency

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Query Parameters as JSON

{
  "asset_code": "BTC",
  "currency_code": "USD",
  "provider": "Bitstamp",
  "deviation": "40",
  "sign": "+",
  "unit": "currency"
}

cURL

curl -g "hodlhodl.com/api/v1/offers/exchange_rate_price?asset_code=BTC&currency_code=USD&provider=Bitstamp&deviation=40&sign=%2B&unit=currency" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
price

Price

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "price": "5040.00"
}

Payment method instructions

Payment method instructions resource

Note. You can view (list, delete) only payment method instructions which you have created. Payment method instruction is relevant to your ‘sell’ orders — they connect general payment method (e.g. “Online payment system -> Moneygram”) with your specific details (e.g. “Pay to account No. 12345”).

Listing payment method instructions

Endpoint

GET /api/v1/payment_method_instructions

Request

Route

GET /api/v1/payment_method_instructions

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/payment_method_instructions" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
payment_method_instructions

Array of Payment method instructions (see Getting payment method instruction for fields description)”

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "payment_method_instructions": [
    {
      "id": "8392",
      "version": "48t8r4",
      "payment_method_id": "9418",
      "name": "Bank account #1",
      "details": "Pay to account No. 12345",
      "created_at": "2024-08-29T23:13:37Z",
      "updated_at": "2024-08-29T23:13:37Z"
    },
    {
      "id": "8393",
      "version": "4fhu0o",
      "payment_method_id": "9418",
      "name": "Bank account #2",
      "details": "Pay to account No. 67890",
      "created_at": "2024-08-29T23:13:37Z",
      "updated_at": "2024-08-29T23:13:37Z"
    }
  ]
}

Getting payment method instruction

Endpoint

GET /api/v1/payment_method_instructions/:id

Parameters

Name Description
id

Payment method instruction ID

Request

Route

GET /api/v1/payment_method_instructions/8395

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/payment_method_instructions/8395" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
payment_method_instruction

Payment method instruction

payment_method_instruction.id

ID

payment_method_instruction.version

Version

payment_method_instruction.payment_method_id

Payment method ID

payment_method_instruction.name

Name (visible only to you)

payment_method_instruction.details

Text of the instruction

payment_method_instruction.created_at

Date-time of creation (ISO 8601)

payment_method_instruction.updated_at

Date-time of last update (ISO 8601)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "payment_method_instruction": {
    "id": "8395",
    "version": "6zdj6g",
    "payment_method_id": "9419",
    "name": "Bank account #1",
    "details": "Pay to account No. 12345",
    "created_at": "2024-08-29T23:13:37Z",
    "updated_at": "2024-08-29T23:13:37Z"
  }
}

Deleting payment method instruction

Endpoint

DELETE /api/v1/payment_method_instructions/:id

Parameters

Name Description
id

Payment method instruction ID

Request

Route

DELETE /api/v1/payment_method_instructions/8396

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl "hodlhodl.com/api/v1/payment_method_instructions/8396" -d '' -X DELETE \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success"
}

Creating payment method instruction

Endpoint

POST /api/v1/payment_method_instructions

Parameters

Name Description
payment_method_instruction.payment_method_id

Payment method ID

payment_method_instruction.name

Name (visible only to you)

payment_method_instruction.details

Text of the instruction

Request

Route

POST /api/v1/payment_method_instructions

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "payment_method_instruction": {
    "name": "Bank account #1",
    "details": "Pay to account No. 12345",
    "payment_method_id": 9423
  }
}

cURL

curl "hodlhodl.com/api/v1/payment_method_instructions" -d '{"payment_method_instruction":{"name":"Bank account #1","details":"Pay to account No. 12345","payment_method_id":9423}}' -X POST \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
payment_method_instruction

Payment method instruction (see Getting payment method instruction for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "payment_method_instruction": {
    "id": "8399",
    "version": "13tovi",
    "payment_method_id": "9423",
    "name": "Bank account #1",
    "details": "Pay to account No. 12345",
    "created_at": "2024-08-29T23:13:38Z",
    "updated_at": "2024-08-29T23:13:38Z"
  }
}

Updating payment method instruction

Endpoint

PUT /api/v1/payment_method_instructions/:id

Parameters

Name Description
id

Payment method instruction ID

payment_method_instruction.payment_method_id

Payment method ID

payment_method_instruction.name

Name (visible only to you)

payment_method_instruction.details

Text of the instruction

Request

Route

PUT /api/v1/payment_method_instructions/8400

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Body

{
  "payment_method_instruction": {
    "name": "Bank account #2",
    "details": "Pay to account No. 54321",
    "payment_method_id": 9426
  }
}

cURL

curl "hodlhodl.com/api/v1/payment_method_instructions/8400" -d '{"payment_method_instruction":{"name":"Bank account #2","details":"Pay to account No. 54321","payment_method_id":9426}}' -X PUT \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
payment_method_instruction

Payment method instruction (see Getting payment method instruction for fields description)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "payment_method_instruction": {
    "id": "8400",
    "version": "6pakro",
    "payment_method_id": "9426",
    "name": "Bank account #2",
    "details": "Pay to account No. 54321",
    "created_at": "2024-08-29T23:13:38Z",
    "updated_at": "2024-08-29T23:13:38Z"
  }
}

Payment methods

Payment methods resource

Listing payment methods

Note. Payment method type is one of the following:

  • "Bank wire"
  • "Cash"
  • "Cryptocurrency"
  • "Online payment system"

Endpoint

GET /api/v1/payment_methods

Parameters

Name Description
filters.country

Country name or code ("Global" to list global payment methods, omit to return all payment methods)

Request

Route

GET /api/v1/payment_methods?filters[country]=China

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

Query Parameters as JSON

{
  "filters": {
    "country": "China"
  }
}

cURL

curl -g "hodlhodl.com/api/v1/payment_methods?filters[country]=China" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
payment_methods

Payment methods array

payment_methods[#].id

ID

payment_methods[#].type

Type

payment_methods[#].name

Name

payment_methods[#].country_codes

Array of country codes

payment_methods[#].description

Description

payment_methods[#].discounted

Discounted? (true or false)

payment_methods[#].global

Global? (true or false)

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "filters": {
    "country": "China"
  },
  "payment_methods": [
    {
      "id": "9428",
      "type": "Bank wire",
      "name": "Example payment system (two countries)",
      "country_codes": [
        "CHN"
      ],
      "description": {
      },
      "discounted": false,
      "global": false
    },
    {
      "id": "9427",
      "type": "Online payment system",
      "name": "Example payment system (single country)",
      "country_codes": [
        "CHN"
      ],
      "description": {
      },
      "discounted": false,
      "global": false
    }
  ]
}

Timezones

Timezones resource

Listing timezones

Endpoint

GET /api/v1/timezones

Request

Route

GET /api/v1/timezones

cURL

curl -g "hodlhodl.com/api/v1/timezones" -X GET \
	-H "Version: HTTP/1.0"

Response

Simulated Response

Response Fields

Name Description
name

Timezone name

gmt_offset

Timezone GMT offset

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "timezones": [
    {
      "name": "Abu Dhabi",
      "gmt_offset": "+04:00"
    },
    {
      "name": "Adelaide",
      "gmt_offset": "+09:30"
    },
    {
      "name": "Alaska",
      "gmt_offset": "-09:00"
    },
    {
      "name": "Almaty",
      "gmt_offset": "+05:00"
    },
    {
      "name": "American Samoa",
      "gmt_offset": "-11:00"
    },
    {
      "name": "Amsterdam",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Arizona",
      "gmt_offset": "-07:00"
    },
    {
      "name": "Astana",
      "gmt_offset": "+06:00"
    },
    {
      "name": "Athens",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Atlantic Time (Canada)",
      "gmt_offset": "-04:00"
    },
    {
      "name": "Auckland",
      "gmt_offset": "+12:00"
    },
    {
      "name": "Azores",
      "gmt_offset": "-01:00"
    },
    {
      "name": "Baghdad",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Baku",
      "gmt_offset": "+04:00"
    },
    {
      "name": "Bangkok",
      "gmt_offset": "+07:00"
    },
    {
      "name": "Beijing",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Belgrade",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Berlin",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Bern",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Bogota",
      "gmt_offset": "-05:00"
    },
    {
      "name": "Brasilia",
      "gmt_offset": "-03:00"
    },
    {
      "name": "Bratislava",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Brisbane",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Brussels",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Bucharest",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Budapest",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Buenos Aires",
      "gmt_offset": "-03:00"
    },
    {
      "name": "Cairo",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Canberra",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Cape Verde Is.",
      "gmt_offset": "-01:00"
    },
    {
      "name": "Caracas",
      "gmt_offset": "-04:00"
    },
    {
      "name": "Casablanca",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Central America",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Central Time (US & Canada)",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Chatham Is.",
      "gmt_offset": "+12:45"
    },
    {
      "name": "Chennai",
      "gmt_offset": "+05:30"
    },
    {
      "name": "Chihuahua",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Chongqing",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Copenhagen",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Darwin",
      "gmt_offset": "+09:30"
    },
    {
      "name": "Dhaka",
      "gmt_offset": "+06:00"
    },
    {
      "name": "Dublin",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Eastern Time (US & Canada)",
      "gmt_offset": "-05:00"
    },
    {
      "name": "Edinburgh",
      "gmt_offset": "+00:00"
    },
    {
      "name": "Ekaterinburg",
      "gmt_offset": "+05:00"
    },
    {
      "name": "Fiji",
      "gmt_offset": "+12:00"
    },
    {
      "name": "Georgetown",
      "gmt_offset": "-04:00"
    },
    {
      "name": "Greenland",
      "gmt_offset": "-02:00"
    },
    {
      "name": "Guadalajara",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Guam",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Hanoi",
      "gmt_offset": "+07:00"
    },
    {
      "name": "Harare",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Hawaii",
      "gmt_offset": "-10:00"
    },
    {
      "name": "Helsinki",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Hobart",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Hong Kong",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Indiana (East)",
      "gmt_offset": "-05:00"
    },
    {
      "name": "International Date Line West",
      "gmt_offset": "-12:00"
    },
    {
      "name": "Irkutsk",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Islamabad",
      "gmt_offset": "+05:00"
    },
    {
      "name": "Istanbul",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Jakarta",
      "gmt_offset": "+07:00"
    },
    {
      "name": "Jerusalem",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Kabul",
      "gmt_offset": "+04:30"
    },
    {
      "name": "Kaliningrad",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Kamchatka",
      "gmt_offset": "+12:00"
    },
    {
      "name": "Karachi",
      "gmt_offset": "+05:00"
    },
    {
      "name": "Kathmandu",
      "gmt_offset": "+05:45"
    },
    {
      "name": "Kolkata",
      "gmt_offset": "+05:30"
    },
    {
      "name": "Krasnoyarsk",
      "gmt_offset": "+07:00"
    },
    {
      "name": "Kuala Lumpur",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Kuwait",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Kyiv",
      "gmt_offset": "+02:00"
    },
    {
      "name": "La Paz",
      "gmt_offset": "-04:00"
    },
    {
      "name": "Lima",
      "gmt_offset": "-05:00"
    },
    {
      "name": "Lisbon",
      "gmt_offset": "+00:00"
    },
    {
      "name": "Ljubljana",
      "gmt_offset": "+01:00"
    },
    {
      "name": "London",
      "gmt_offset": "+00:00"
    },
    {
      "name": "Madrid",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Magadan",
      "gmt_offset": "+11:00"
    },
    {
      "name": "Marshall Is.",
      "gmt_offset": "+12:00"
    },
    {
      "name": "Mazatlan",
      "gmt_offset": "-07:00"
    },
    {
      "name": "Melbourne",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Mexico City",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Mid-Atlantic",
      "gmt_offset": "-02:00"
    },
    {
      "name": "Midway Island",
      "gmt_offset": "-11:00"
    },
    {
      "name": "Minsk",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Monrovia",
      "gmt_offset": "+00:00"
    },
    {
      "name": "Monterrey",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Montevideo",
      "gmt_offset": "-03:00"
    },
    {
      "name": "Moscow",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Mountain Time (US & Canada)",
      "gmt_offset": "-07:00"
    },
    {
      "name": "Mumbai",
      "gmt_offset": "+05:30"
    },
    {
      "name": "Muscat",
      "gmt_offset": "+04:00"
    },
    {
      "name": "Nairobi",
      "gmt_offset": "+03:00"
    },
    {
      "name": "New Caledonia",
      "gmt_offset": "+11:00"
    },
    {
      "name": "New Delhi",
      "gmt_offset": "+05:30"
    },
    {
      "name": "Newfoundland",
      "gmt_offset": "-03:30"
    },
    {
      "name": "Novosibirsk",
      "gmt_offset": "+07:00"
    },
    {
      "name": "Nuku'alofa",
      "gmt_offset": "+13:00"
    },
    {
      "name": "Osaka",
      "gmt_offset": "+09:00"
    },
    {
      "name": "Pacific Time (US & Canada)",
      "gmt_offset": "-08:00"
    },
    {
      "name": "Paris",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Perth",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Port Moresby",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Prague",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Pretoria",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Puerto Rico",
      "gmt_offset": "-04:00"
    },
    {
      "name": "Quito",
      "gmt_offset": "-05:00"
    },
    {
      "name": "Rangoon",
      "gmt_offset": "+06:30"
    },
    {
      "name": "Riga",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Riyadh",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Rome",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Samara",
      "gmt_offset": "+04:00"
    },
    {
      "name": "Samoa",
      "gmt_offset": "+13:00"
    },
    {
      "name": "Santiago",
      "gmt_offset": "-04:00"
    },
    {
      "name": "Sapporo",
      "gmt_offset": "+09:00"
    },
    {
      "name": "Sarajevo",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Saskatchewan",
      "gmt_offset": "-06:00"
    },
    {
      "name": "Seoul",
      "gmt_offset": "+09:00"
    },
    {
      "name": "Singapore",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Skopje",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Sofia",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Solomon Is.",
      "gmt_offset": "+11:00"
    },
    {
      "name": "Srednekolymsk",
      "gmt_offset": "+11:00"
    },
    {
      "name": "Sri Jayawardenepura",
      "gmt_offset": "+05:30"
    },
    {
      "name": "St. Petersburg",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Stockholm",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Sydney",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Taipei",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Tallinn",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Tashkent",
      "gmt_offset": "+05:00"
    },
    {
      "name": "Tbilisi",
      "gmt_offset": "+04:00"
    },
    {
      "name": "Tehran",
      "gmt_offset": "+03:30"
    },
    {
      "name": "Tijuana",
      "gmt_offset": "-08:00"
    },
    {
      "name": "Tokelau Is.",
      "gmt_offset": "+13:00"
    },
    {
      "name": "Tokyo",
      "gmt_offset": "+09:00"
    },
    {
      "name": "UTC",
      "gmt_offset": "+00:00"
    },
    {
      "name": "Ulaanbaatar",
      "gmt_offset": "+08:00"
    },
    {
      "name": "Urumqi",
      "gmt_offset": "+06:00"
    },
    {
      "name": "Vienna",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Vilnius",
      "gmt_offset": "+02:00"
    },
    {
      "name": "Vladivostok",
      "gmt_offset": "+10:00"
    },
    {
      "name": "Volgograd",
      "gmt_offset": "+03:00"
    },
    {
      "name": "Warsaw",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Wellington",
      "gmt_offset": "+12:00"
    },
    {
      "name": "West Central Africa",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Yakutsk",
      "gmt_offset": "+09:00"
    },
    {
      "name": "Yerevan",
      "gmt_offset": "+04:00"
    },
    {
      "name": "Zagreb",
      "gmt_offset": "+01:00"
    },
    {
      "name": "Zurich",
      "gmt_offset": "+01:00"
    }
  ]
}

Users

Users resource

Getting myself

This method will return information on current user.

Endpoint

GET /api/v1/users/me

Request

Route

GET /api/v1/users/me

Headers

Authorization: Bearer aAb2qlDKQZsS4V1gPHT9.......
Content-Type: application/json

cURL

curl -g "hodlhodl.com/api/v1/users/me" -X GET \
	-H "Version: HTTP/1.0" \
	-H "Authorization: Bearer aAb2qlDKQZsS4V1gPHT9......." \
	-H "Content-Type: application/json"

Response

Simulated Response

Response Fields

Name Description
user.login

Login

user.avatar_url

Avatar URL

user.online_status

"online", "recently_online" or "offline"

user.rating

Rating (as fraction of 1)

user.trades_count

Number of conducted trades

user.url

Hodlhodl website URL

user.verified

Verified? (true or false)

user.verified_by

Login of the Strong Hodler who verified this user

user.strong_hodler

Strong Hodler? (true or false)

Strong Hodler is a member of Hodl Hodl volunteer team that we’re working directly with.

user.country

Country name (or "Global")

user.country_code

Country code (or "Global")

user.average_payment_time_minutes

Average payment time (in minutes)

user.average_release_time_minutes

Average release time (in minutes)

user.days_since_last_trade

Number of days since last trade

user.blocked_by

How many traders blocked this user

user.encrypted_seed

Encrypted seed

user.hide_sensitive_info_from_notifications

If enabled, e-mail and Telegram notifications will not contain sensitive information

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "status": "success",
  "user": {
    "login": "test_user",
    "avatar_url": "http://example.org/assets/default_avatar-f5b0258802df64cd87d94b95a1faed32b1b464bfb9b1cef2a10f6c30ddc91158.svg",
    "online_status": "offline",
    "rating": null,
    "my_review": null,
    "trades_count": 0,
    "url": "http://hodlhodl.com/accounts/test_user",
    "verified": false,
    "verified_by": null,
    "strong_hodler": false,
    "country": "Country 144",
    "country_code": "Country Code 144",
    "average_payment_time_minutes": null,
    "average_release_time_minutes": null,
    "days_since_last_trade": null,
    "blocked_by": 0,
    "encrypted_seed": "12345",
    "hide_sensitive_info_from_notifications": null
  }
}