Fixedfloat

Fixedfloat API Request Signing With HMAC-SHA256

Fixedfloat authenticates JSON requests with HMAC-SHA256 in its v2 API for retrieving quotes, creating swap orders, and managing existing orders. Your API secret supplies the signing key, and request headers carry your API key and the resulting hexadecimal signature. The signature covers the serialized request body, so signing and sending must use identical bytes. Rates, availability, and order status remain separate live conditions that a correct signature cannot resolve.

Last updated
Bottom line: A successful order-creation response establishes an order, while subsequent status updates show whether the exchange has completed.

Request-body authentication

The API key identifies the credentials for a request, while the secret produces a signature tied to its body. A keyed-hash message authentication code (HMAC) uses a shared secret to authenticate a message. The receiving system can calculate the corresponding value and compare it with the supplied signature. Changing the message requires calculating a matching signature for the new bytes. Anyone who obtains the secret can also generate these values, which makes secret storage part of the authentication design.

Encrypted transport protects the JSON body’s confidentiality in transit, while HMAC addresses authentication and integrity.

API credentials and access purpose

Account-based API credentials precede signed requests, and their declared use determines which integration terms apply. Generate the key and secret through the account’s API management area. The available purposes distinguish personal use from commercial use with or without the affiliate program. A valid signature does not change that purpose. Keep the secret in a server-side component, since anyone who can inspect a downloaded browser bundle can retrieve a secret embedded in it. Limit access to the software and operators that need signing privileges.

Which bytes does the signature cover?

The signature covers the UTF-8 bytes of the JSON body that your client actually sends. Serialize the request object once, then use that encoded buffer for signing and transmission. Recreating the payload later can introduce different whitespace or escapes. A JSON parser can read equivalent objects from different strings; HMAC operates on their bytes. Pretty-printing or reordering object members after signing changes the verification input. Keep serializer options consistent and prevent a transport wrapper from silently rebuilding the body.

Fixedfloat: Which bytes does the signature cover?

Open full-size image

An empty body and the text {} are different messages. The ccies method supports these no-parameter forms; calculate the signature from whichever form you actually transmit.

JSON validation should enforce double-quoted member names and valid numeric values before signing. Python’s serializer can emit NaN and Infinity unless you disable that extension; these tokens fall outside standard JSON. Reject invalid amounts before preparing a request, using strict serialization where appropriate. A correctly computed HMAC over malformed JSON still leaves the server unable to process the intended parameters.

A shared signing routine

A signing routine can prepare the body and authentication headers together, keeping serialization under one component’s control. An untruncated HMAC-SHA256 digest contains 256 bits, represented by 64 hexadecimal characters. Python’s hexdigest() returns the hexadecimal form, while digest() returns raw bytes. The headers carry the API key, hexadecimal signature, and JSON content type. This function accepts request parameters and credentials without embedding either in its source code.

import hashlib
import hmac
import json

def prepare_request(params, api_key, api_secret):
 body = json.dumps(
 params, ensure_ascii=False, allow_nan=False
 ).encode("utf-8")
 signature = hmac.new(
 api_secret.encode("utf-8"), body, hashlib.sha256
 ).hexdigest()
 headers = {
 "Content-Type": "application/json; charset=UTF-8",
 "X-API-KEY": api_key,
 "X-API-SIGN": signature,
 }
 return body, headers

The HTTP client must transmit the returned body unchanged; this function prepares authentication data without submitting a request.

Amount direction and live quote conditions

The amount direction determines which currency supplies the units for the requested amount, while quote responses reveal changing exchange conditions. With direction set to from, amount refers to fromCcy; setting direction to to makes it refer to toCcy. Keep this relationship explicit when constructing parameters. A correct signature preserves whatever direction your software chose, including a mistaken one. The API currency code also needs to identify the intended asset and network. Order creation additionally requires toAddress for the receiving asset, with a destination tag where the selected asset requires one.

Fixedfloat: Amount direction and live quote conditions - diagram
Visual summary: Amount direction and live quote conditions.

Open full-size image

The price method supplies a quote and reports order-creation problems in data.errors. Amount limits, maintenance, availability, and reserves can affect that response. These conditions belong to the selected exchange and the time of the request. An empty errors array describes that quote’s eligibility for creation; later conditions can change. Inspect the sending and receiving amounts in their respective objects, preserving the units attached to each side.

A quote request below its live minimum

In this hypothetical example, an integration wants a quote before creating an order or transferring funds. Its selected currencies, rate choice, requested amount A, and returned minimum M are hypothetical. The signing rule stays exact: the secret and serialized body determine the authentication value.

The minimum M is a live response value, measured in the sending currency. The integration prepares a sending-amount request with direction set to from and amount set to A. It signs that body and submits it to price. The response reports M greater than A and identifies the amount-limit problem.

The application displays that problem and leaves order creation disabled. The quote request has created no exchange order and transferred no cryptocurrency. Changing A would require a new signature for the revised body. A later quote can return a different minimum even when the amount and signing routine stay unchanged.

Order credentials and completion signals

Order-specific credentials connect later API calls to a created order, while its status distinguishes method success from exchange completion. The create response includes an order id and access token. The order method requires both to retrieve updated details, alongside normal request authentication. Store that token privately. An API response with code equal to 0 identifies method success. That value alone does not establish delivery of the receiving asset.

The status NEW identifies a new order, while DONE identifies completion. Intermediate states describe processing. Display the returned state without translating every successful HTTP response into a completed swap.

Signature errors and request limits

Signature diagnostics begin with the signed bytes, while traffic controls account for the service’s weighted request budget. Compare the prepared body with the bytes handed to the HTTP client. Check that the secret matches the supplied key and retain the full hexadecimal digest. Separate authentication failures from invalid parameters, connection errors, and quote restrictions. Polling and creation traffic share the API allowance, with order creation carrying a higher weight. Check the API’s request-limit documentation for the current per-minute allowance and method weights. Repeated attempts cannot repair a body mismatch. Exceeding the request limit causes a temporary block, and repeated breaches after unblocking increase its duration.

Uncertain responses and limited recovery

An order-creation timeout leaves the outcome uncertain when the server may have processed the request before communication failed. Automatic retries of a non-idempotent request require evidence that replay is safe or that the original request was never applied. A matching HMAC establishes neither condition. Keep submission results separate from later order state when deciding whether another creation attempt is appropriate.

Uncertain responses and limited recovery (Fixedfloat)
Visual summary: Uncertain responses and limited recovery.

Open full-size image

Saved order credentials permit a request for updated details. If the creation response never arrived, the integration may lack those credentials. Reconcile that uncertain creation attempt before treating a new request as a replacement. Changing the signature does not cancel an earlier order.

An EMERGENCY status requires an action choice for the affected order. The authenticated emergency method records a choice to continue the exchange at the market rate when the choice is made or the order is corrected, or to receive a refund minus the miner fee. A refund choice requires a return address and any necessary destination tag. A successful Boolean response confirms that the choice was set, while subsequent order details establish what happened afterward. Accepting a choice does not itself confirm the movement of funds.

Fixedfloat questions, answered

Does the XML rate export require an HMAC signature?

The XML rate export does not require an API key or request signature. It uses a separate GET interface for exchange-rate information. That exception applies to the export itself; it does not remove authentication requirements from the JSON methods that create or manage orders.

Are affiliate parameters available with a personal-use API key?

A personal-use API key does not permit the affiliate parameters afftax and refcode in price or create requests. Affiliate functionality belongs to the relevant commercial API arrangement. The selected key purpose and applicable approval conditions govern access; generating a correct signature does not grant affiliate privileges.

How does Python Requests handle an already serialized JSON body?

Python Requests sends an already serialized body directly when you pass it through the data argument. Passing a dictionary through data instead triggers form encoding. The json argument performs its own JSON serialization, so using it after signing a separately generated body risks a mismatch. Supply the prepared bytes and matching headers together.

Can API order notifications be sent by email?

The setEmail method subscribes an order to email notifications about status changes. Its request identifies the order with its id and access token and supplies the notification address. Normal request authentication still applies. Successful subscription confirms notification registration, while the order’s status describes the exchange’s progress.

What format does the QR-code method return?

The qr method returns named QR-code images encoded in Base64. Each returned object includes image data and a flag identifying the default choice. The request requires the order’s id and token. An image supports payment presentation; retrieving it does not authorize a wallet transaction or establish an exchange’s completion.

Will valid request signatures prevent transaction screening?

Valid request signatures do not exempt API exchanges from transaction screening. The service can check incoming transactions under its exchange terms and suspend an exchange for review. In a commercial integration, the applicable API terms also require the partner to notify the affected customer about contacting the security team.

Do request timeouts impose a maximum exchange duration?

An HTTP client’s timeout limits its wait for communication, not the cryptocurrency exchange’s duration. In Python Requests, timeout handling concerns connection and socket-read waits rather than a fixed deadline for the entire swap. A timeout therefore cannot establish that an order expired, failed, or never reached the service.

What information should an integration omit from diagnostic logs?

Diagnostic logs should omit API secrets, authentication headers, and order access tokens. Unfiltered request bodies for order-management methods can contain those tokens, so redacting headers alone leaves sensitive data exposed. Retain the method name, relevant status, and a safe correlation identifier where useful. Restrict diagnostic access and remove sensitive values before sending logs elsewhere.