liaisev5.3.1
/Endpoint options

Reference

Endpoint options

This page lists every option a REST endpoint takes. Look here when you write a defineRequest or a new Request and need an option’s exact type or default.

defineRequest<T>()(config) and new Request(config) both take a RequestConfig. Defining endpoints explains their type arguments.

OptionTypeDefaultWhat it does
method'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'requiredThe HTTP method.
pathstringrequiredThe path after baseUrl. Each :name that starts a path segment is filled from the params (Path params). A # is refused (URL fragments), and so is a :name in the query string (Colons in a path).
middlewareMiddleware[]—Runs on every call to this endpoint, after client middleware and before call middleware.
headersHeadersInit—Sent with every call to this endpoint. Replaces the client’s value for the same header.
fetchOptionsFetchOptions—Options passed through to fetch on every call to this endpoint, such as cache: 'no-store'. Each field replaces the client’s.
responseType'json' | 'text' | 'blob' | 'arrayBuffer' | 'formData' | 'none''json'How the response body is read (Reading responses).
schemaStandardSchemaV1—Checks a 2xx body, and data becomes the schema’s output. With defineRequest, it also supplies the response type (Validating responses).
dedupebooleanfalseA new call cancels the one still running (Drop stale calls with dedupe).
sharebooleanfalseCalls that would send the identical request share one network request (Sharing identical requests). Can’t be combined with dedupe: createApi throws if both are set.
bodyAs'query' | 'body''query' for GET and DELETE, 'body' for the restWhere the params that aren’t in the path go (Query string or body).
timeoutnumber (ms)the client’s timeoutOne deadline for the whole call, retries included. Replaces the client’s, and 0 turns it off (Set a deadline with timeout). Under share, it is also the shared request’s deadline (Share key and refcount).

Next: Operation options lists what one GraphQL operation can set.

esc