Skip to main content
Most institutions use scheduled downloads — see Statements. This page is for institutions wiring Musubi into a TMS/ERP (Kyriba, SAP, Oracle) or with real-time reconciliation needs that can’t wait for batch exports.
Musubi exposes REST + SSE APIs and (coming) a webhook callback. Most treasury systems prefer push webhooks over long-lived SSE; SSE is available for services that can keep a streaming connection open.

When to use this

  • You’re wiring Musubi into a TMS or ERP (Kyriba, SAP S/4HANA, Oracle TRM, etc.)
  • Your accounting posts trades to the GL in real time
  • Your treasury automation initiates orders based on internal rules (payment schedules, sweep triggers)
  • You’re building a custom treasury dashboard
If none of those apply, Console + Statements is the simpler path.

Authentication

JWT bearer token, typically refreshed every hour. Full details: Authentication. Cache the token, refresh ~60 seconds before expiry, retry once on 401 after a forced refresh.

Integration modes

REST — order initiation

For institutions automating order initiation (e.g., scheduled payments from a TMS):
EndpointPurpose
POST /api/v1/ordersCreate a new FX order
GET /api/v1/orders/{intent_id}/quotesList quotes for an order
POST /api/v1/orders/{intent_id}/quotes/{quote_id}/acceptAccept a quote
POST /api/v1/orders/{intent_id}/cancelCancel a PENDING or QUOTED order
GET /api/v1/orders/{intent_id}Get order by ID
Request/response shapes: API Reference.
// Typed DTOs matching /institution/api-reference shapes.
public record ApiResponse<T>(T data) {}
public record CreateOrderRequest(
    String senderCustodianPartyId, String intentSignature,
    String receiverPartyId, String receiverCustodianPartyId,
    String sourceContractId, String sourceCurrency,
    String targetAmount, String targetCurrency,
    String sourceAmountMax, String kycAmlRef,
    String jurisdictionSender, String jurisdictionReceiver,
    String memo) {}
public record OrderDto(
    String intentId, String status, String fxRate,
    String sourceAmountActual, String transactionHash,
    Instant settledAt) {}
@Service
public class MusubiInstitutionClient {
  private final WebClient rest;

  public MusubiInstitutionClient(WebClient.Builder b,
                                 @Value("${musubi.backend-url}") String url,
                                 MusubiAuthProvider auth) {
    this.rest = b.baseUrl(url)
        .filter((req, next) -> next.exchange(
            ClientRequest.from(req).headers(h -> h.setBearerAuth(auth.token())).build()))
        .build();
  }

  public OrderDto createOrder(CreateOrderRequest req) {
    return rest.post().uri("/api/v1/orders")
        .bodyValue(req)
        .retrieve()
        .bodyToMono(new ParameterizedTypeReference<ApiResponse<OrderDto>>() {})
        .map(ApiResponse::data)
        .block();
  }

  public OrderDto acceptQuote(String intentId, String quoteId) {
    return rest.post().uri("/api/v1/orders/{id}/quotes/{qid}/accept", intentId, quoteId)
        .retrieve()
        .bodyToMono(new ParameterizedTypeReference<ApiResponse<OrderDto>>() {})
        .map(ApiResponse::data)
        .block();
  }
}

TMS/ERP integration notes

  • Idempotency — key accounting posts by intent_id + transaction_hash. Webhook retries or SSE reconnects can replay events.
  • Reconciliation — match intent_id back to your internal payment reference (store it as a memo prefix or in your own ID mapping table).
  • FX posting — post the JPYSC0 out-leg at source_amount_actual × fx_rate equivalent, and the USDCx in-leg at target_amount. The transaction_hash is your settlement proof.
  • Cost-guard policy — set source_amount_max from your treasury risk rules, not from the UI. Orders exceeding the guard return SLIPPAGE without settling.

Other stacks

Same patterns apply:
  • Nodefetch for REST; EventSource (native) or eventsource package for SSE; express/fastify HMAC-verifying webhook handler
  • Pythonhttpx or requests for REST; httpx-sse for SSE; Flask/FastAPI with hmac.compare_digest for webhooks
  • KotlinWebClient + ktor-client-cio works

Next steps

  • For institutions not automating, the Console + Statements path covers the same workflow without code — see Console and Statements.
  • Full endpoint reference — API Reference.