align-justifyBatch Send

Nozomi sendBatch Client Integration Guide

1. What sendBatch does

POST /api/sendBatch lets you submit multiple raw Solana transactions in one request using a compact binary format (no base64).

Use this when you already have serialized tx bytes and want to reduce per-request overhead.

2. Endpoint and auth

  • Method: POST

  • Path: /api/sendBatch

  • Required query param: c=<client_id>

  • Recommended header: Content-Type: application/octet-stream

Example URL:

https://YOUR_HOST/api/sendBatch?c=YOUR_CLIENT_ID

3. Binary wire format

Body is a concatenation of entries:

[len_hi][len_lo][tx_bytes...] [len_hi][len_lo][tx_bytes...] ...

  • len_hi,len_lo: unsigned big-endian u16 length

  • len > 0

  • tx_bytes: raw serialized transaction bytes for that entry

No separators and no JSON wrapper are used.

4. Limits and validation

  • Max entries per request: 16

  • Max tx size per entry: 1232 bytes

  • Min tx size accepted: 66 bytes

  • Max total request body: 19,744 bytes (16 * (1232 + 2))

Requests violating framing, count, or parsing rules are rejected.

5. Response behavior (important)

sendBatch is stream-processed.

That means entries are handled in order as bytes arrive. If entry N fails:

  • entries 1..N-1 may already be accepted and forwarded

  • there is no rollback

  • response is an error for the overall request

Your client should treat this endpoint as partially successful on some failures.

6. HTTP status codes and response bodies

All responses are plain text (text/plain).

  • 200 OK + empty body Full request accepted.

  • 400 Bad Request + Bad Request\n Framing/format errors (invalid length prefixes, truncated payload, too many entries, empty batch, etc.).

  • 400 Bad Request + Transaction too large\n At least one tx exceeded allowed size, or body exceeded max cap.

  • 400 Bad Request + Failed to parse transaction\n Transaction bytes failed metadata/parse checks.

  • 400 Bad Request + Malformed transaction string\n Transaction payload is malformed (for example, too small).

  • 400 Bad Request + Insufficient tip\n Tx did not satisfy configured tip policy.

  • 401 Unauthorized + Unauthorized\n Missing/invalid c client id.

  • 429 Too Many Requests + Too Many Requests\n Rate limit exceeded.

  • 405 Method Not Allowed + Used HTTP Method is not allowed. POST is required\n Non-POST usage.

  • 500 Internal Server Error + Internal Server Error\n Internal forwarding/queue failure.

7. JavaScript reference implementation

8. curl example

9. Production recommendations

  1. Keep batch sizes small enough for your retry strategy (for example 2-8 txs).

  2. Track tx signatures client-side before send, so you can reconcile partial success.

  3. On non-200 responses, do not assume the whole batch failed.

  4. Make retries idempotent at the tx/signature level in your system.

  5. Log both HTTP status and response text; response text is meaningful for error class.

10. CORS/preflight

  • OPTIONS is supported.

  • Response headers include:

    • Access-Control-Allow-Origin: *

    • Access-Control-Allow-Methods: POST, GET, OPTIONS

    • Access-Control-Allow-Headers: Content-Type

Last updated