# `T3.HTTP`
[🔗](https://github.com/dl-alexandre/t3-elixir/blob/main/lib/t3/http.ex#L1)

Explicit HTTP access to T3's environment API, independent of the MCP session.

    http = T3.HTTP.new(base_url: "http://127.0.0.1:3773", token: access_token)
    T3.HTTP.Orchestration.thread_transcript(http, thread_id)
    T3.HTTP.call(http, :orchestration_thread_history_page,
      params: %{"threadId" => thread_id}, query: %{"cursor" => cursor})

Successes return `{:ok, %T3.HTTP.Response{}}`; failures return `{:error,
%T3.Error{}}`. Configure `:finch` for a custom supervised Finch pool; the SDK
application starts `T3.HTTP.Finch` by default. Credentials need the endpoint's
own scopes: the presence of an MCP token does not imply HTTP authorization.

JSON routes accept `json: wire_map`, token exchanges accept `form: wire_map`,
and uploads/webhooks accept `body: exact_bytes`. Payload schemas remain T3's
responsibility. There are no automatic retries, redirects or cookie storage.

# `t`

```elixir
@type t() :: %T3.HTTP{
  auth_scheme: term(),
  base_url: term(),
  finch: term(),
  headers: term(),
  max_body_bytes: term(),
  pool_timeout: term(),
  timeout: term(),
  token: term()
}
```

# `call`

Call a declared endpoint using :params, :query, :json, :form, :body and :headers options.

# `cancel_stream`

Cancel a streaming Task owned by this process and close its network worker.

# `endpoints`

Return every declared HTTP endpoint.

# `multipart`

Build a multipart body from string fields and local-file or in-memory file tuples.

# `new`

Create an HTTP configuration. Requires an origin URL, HTTPS or loopback HTTP.

# `raw_endpoints`

Routes implemented outside EnvironmentHttpApi, including guest/device/media APIs.

# `request`

Send one same-origin HTTP request. Relative root paths only; absolute URLs and
network-path references are rejected so bearer credentials cannot cross origins.
`:decode` may be `:auto` (default), `:json`, or `:binary`. Response bodies are
bounded by `max_body_bytes`; receive and pool timeouts are bounded too.

# `start_stream`

Start a cancellable streaming Task owned by the calling process.

# `stream`

Stream a response with synchronous callback backpressure; see T3.HTTP.Stream.

# `upload`

POST exact attachment bytes to the relative URL returned by t3_attachment_prepare_upload.

---

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