API boundaries

id_effect_rpc lives in crates/id_effect_rpc and is published with the workspace from 0.12 (tier integration, ADR 0010 Amendment 8). It is the first-party call surface of ADR 0014: see One call surface for procedures, the contract and the transports.

Besides the RPC server and client, id_effect_rpc carries the HTTP boundary helpers this chapter covers: correlation ids, JSON error envelopes, OpenAPI emission, API versioning, and tracing helpers. REST + OpenAPI over typed routes stays the recommended style for public, third-party APIs.

Correlation and errors

Use ensure_correlation_id and RpcError for consistent wire errors. Validate request input (path, query, headers and body) with the typed routes or Valid* extractors of id_effect_axum::route, which answer RFC 9457 application/problem+json errors: see Typed routes and validation.

OpenAPI and the contract

API versioning

versioning::negotiate_api_version resolves version from Accept-Version or /vN/ path prefix:

use id_effect_rpc::versioning::{ApiVersion, VersionConfig, negotiate_api_version};

let cfg = VersionConfig::new(ApiVersion::new("v1"), vec![ApiVersion::new("v1")]);
let app = router.layer(axum::middleware::from_fn_with_state(cfg, negotiate_api_version));

RPC tracing example

cargo run -p id_effect_rpc --example 020_rpc_tracing

Spans use stable field names consumable by id_effect_opentelemetry layers.

See also