Skip to Content
Calls

Call options

Look up an option a call accepts, its default, and the page that explains it.

Every method takes a path and an object of options, such as api.get("/todos/:id", { params: { id: 1 }, output: Todo }). Use this page to look an option up. Each row links to the page that explains it in full.

Options

The following table lists every option a call accepts, with what a call without it does:

OptionWhat it doesDefault
paramsFills in the path's :name segments. Required when the path has any, and not allowed otherwise. See Fill in path parameters.None.
queryBuilds the query string from an object. See Build a query string.None.
headersHeaders for this call. They win over the client's, and over the body's content-type, except on a FormData body. See Set the content type.The client's headers.
bodyThe request body, sent by its type. Only on post, put, patch, del and request, and on sse and ndjson. See Send a body.None: no body.
inputA schema that types body and encodes it. A body that doesn't match makes the call die. See Encode the body with a schema, and Upload files for Fetch.multipart.None: body is sent by its type.
outputA schema the 2xx body is decoded with. See Read the response.None: the call succeeds with the HttpClientResponse.
responseMode"decoded-and-response" makes the call succeed with [value, response]. See Read the body and the response."decoded": the value alone.
errorA schema for the body of error responses, decoded onto HttpError.body. See Catch errors.The client's defaultError, else Schema.Unknown: the parsed JSON.
statusErrorsYour own errors for error responses, by status. Tried before the client's. See Errors by status.None: only the client's apply.
pluginsTurns a plugin off, or changes its options, for this call. See Change plugins for one call.None: each plugin runs with its defaults.

These are the options of the client's methods. An endpoint's call takes a subset of them, since its definition holds the rest (see Call an endpoint).

api.request takes the same options, after the HTTP method. A GET or HEAD request with a body makes the call die (see When the methods aren't enough).

What's next

On this page