Skip to main content
Layerswap clients must support two failure shapes: structured JSON errors and binding-level 400 responses with no body.

Structured errors

Do not assume a stable type for every metadata value; live responses have used both numeric and string StatusCode values.

Empty-body 400s

Invalid enum values, incorrect casing, missing required enum parameters, and other model-binding failures can return HTTP 400 with an empty body. Check the status and Content-Type before calling .json():
Log the endpoint, parameter names, and correlation ID on an empty-body error, but never log an API key, signature, or sensitive address metadata unnecessarily.

Codes you should recognize

The public error-code catalog is not formally versioned. Always retain an unknown-code fallback.

Failures by integration step

For a complete request sequence, see Build your first API swap.