# BinaryAPIResponse

> **Class** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/_openapi_client/_response/BinaryAPIResponse)

Subclass of APIResponse providing helpers for dealing with binary data.

Note: If you want to stream the response data instead of eagerly reading it
all at once then you should use `.with_streaming_response` when making
the API request, e.g. `.with_streaming_response.get_binary_response()`

## Signature

```python
BinaryAPIResponse(
    self,
    *,
    raw: httpx.Response,
    cast_to: type[R],
    client: BaseClient[Any, Any],
    stream: bool,
    stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None,
    options: FinalRequestOptions,
    retries_taken: int = 0,
)
```

## Extends

- `APIResponse[bytes]`

## Methods

- [`write_to_file()`](https://reference.langchain.com/python/langsmith/_openapi_client/_response/BinaryAPIResponse/write_to_file)

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/19d52419f47c93ca2c57a0d51c58d255f5949092/python/langsmith/_openapi_client/_response.py#L477)