Guides
Envelopes and errors
Each Bloquo service answers in its own shape; know which one to expect on each route.
The Bloquo Platform API is made of several services, and each one has its own success shape. Errors, on the other hand, share one shape. The simulator reproduces exactly the shape that Bloquo's response schemas declare for each route.
Success responses
| Routes | Shape |
|---|---|
Customer Service: /customer, /customer/me, /customer/{id}, /account…, /balances, /counterparty…, /customerCounterparty…, /childrenList, currencies, blockchains and types | {"status": true, "statusCode": <http>, "result": …, "message": null} |
| Authentication, transactions, balance by account, trade, notifications, whitelist and sub-accounts | {"status": true, "result": …, "message": null} |
| Deposit, withdrawal and FX payment orders | the order itself, with no envelope |
Named accounts (/accounts), fees (/fee/account/{id}) and FX payment history | bare array |
Reports (/transaction/report, /notification/report) | CSV (text/csv) |
Customer Service example:
{ "status": true, "statusCode": 200, "result": { "id": 1001, "name": "Acme Pagamentos Ltda" }, "message": null }Order example (deposit), with no envelope:
{ "orderCreated": true, "id": 1043, "status": "PENDING_DEPOSIT", "currency": "BRL", "totalAmount": 1000 }Some deletions and actions answer with result: null and a text in message, such as {"status": true, "statusCode": 200, "result": null, "message": "Customer removed with success"}.
Many examples in Bloquo's documentation are auto-generated and contradict the schemas (UUIDs in int64 fields, "status": "active", dates in statusCode). Mimicr follows the schemas. Write your parser per route, not one parser for everything.
Errors
Every error has the same shape:
{ "status": false, "result": null, "message": "Insufficient balance to process order." }| HTTP | When |
|---|---|
| 400 | Validation and business rules, in most cases |
| 401 | Wrong credentials or a missing, invalid or expired token |
| 403 | Customer outside the hierarchy, direct quote for a non-Institutional customer, documents for a non-child |
| 404 | Balance of an unknown account, unknown FX payment, /accounts with no customer, no preferences, unknown route |
| 422 | Trade execution (invalid, expired or used quote, or no balance) and FX payment with an unapproved counterparty |
| 501 | Bloquo route outside the simulated core; see Out of scope |
| 500, 503, 429 | Only when you turn chaos on in the sandbox |
A missing required field answers 400 "<Field> is required.", for example FeatureFlags is required. or TaxId is required.. A non-integer id answers 400 "The value '<value>' is not valid for <field>.", and a body that isn't JSON, 400 The request body is not valid JSON..
Bloquo doesn't document the shape of validation failures. The "<Field> is required." message is a Mimicr decision.
Handle errors
- Decide on the HTTP status and use
messagefor logs and for operators. Messages are English text, with no error code. - Handle a trade execution
422by requesting a new quote. - On
401, authenticate again and retry the call once. - On
5xxand429, retry with increasing backoff.
To trigger 500, 503 and 429 on purpose, configure chaos through the control API (see Sandbox control). The bodies use the same error envelope: An unexpected error occurred., Service unavailable. and Too many requests..