Skip to content

ExamplesRaw Data Mode

Raw Data Mode

Access full response metadata through .raw — status code, headers, and data in one object.

both modes

Normal Mode

Returns just the response data.

ts
// Default — returns just the data
const users = await caller.users.getAll()
// → { data: [...], total: 3 }
caller.users.getAll()SANDBOX
idle
// run the request to see the response

Raw Data Mode

Returns status, headers, and data.

ts
// .raw accessor — returns { status, headers, data }
const response = await caller.users.raw.getAll()

// response.status  → 200
// response.headers → Headers { etag, vary, … }: those that describe the answer
// response.data    → { data: [...], total: 3 }
caller.users.raw.getAll()SANDBOX
idle
// run the request to see the response
Raw data docs

Type Safety

TypeScript follows the accessor: .raw types the call as an HttpResponse.

ts
// The .raw accessor changes what the call is typed to return
const data = await caller.users.getAll()
//    ^? { data: User[]; total: number }

const response = await caller.users.raw.getAll()
//    ^? HttpResponse<{ data: User[]; total: number }>
//       { status: number; headers: Headers; data: … }

With the .raw accessor, the return type wraps data in an HttpResponse object with status and headers. Without it, you get the data directly.