# `Weavr.Error.API`
[🔗](https://github.com/iamkanishka/weavr/blob/main/lib/weavr/error.ex#L28)

Raised/returned when the Weavr API responds with an HTTP error status
(4xx or 5xx) and a parsed error body.

Field meanings follow the response shapes documented for Weavr Multi
endpoints (see e.g. the `bulks/{bulk_id}` operation):

  * `:status` - the HTTP status code (400, 401, 403, 404, 409, 429, 500, 503, ...)
  * `:code` - the API-provided machine-readable error code, when present
     (e.g. `"INSUFFICIENT_PERMISSIONS"`, `"REQUIRED"`)
  * `:message` - the API-provided human-readable message, when present
  * `:errors` - structured per-field validation errors, when the API
     returns a `syntaxErrors.invalidFields`-style payload
  * `:body` - the full decoded JSON response body, for anything not
     captured by the fields above
  * `:request_id` - the value of the response's request/trace id header,
     if Weavr returned one, useful when contacting Weavr support

# `t`

```elixir
@type t() :: %Weavr.Error.API{
  __exception__: true,
  body: map() | nil,
  code: String.t() | nil,
  errors: list() | nil,
  message: String.t() | nil,
  request_id: String.t() | nil,
  status: pos_integer()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
